mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-13 06:36:26 +03:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b9353be6d | ||
|
|
ab48affa4a | ||
|
|
b67bf6159f | ||
|
|
d90806be42 | ||
|
|
91a4df5093 | ||
|
|
cd12f8660e | ||
|
|
43088d8fbf | ||
|
|
a8ce5962d3 | ||
|
|
7d6c5bdd92 | ||
|
|
73552b79c5 | ||
|
|
73a6f51a54 |
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
license: Apache 2.0
|
||||
allowed-tools:
|
||||
- Bash(npx impeccable *)
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
metadata:
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
---
|
||||
|
||||
This skill gives you the tools and permission to create design that earns to be called out-of-distribution craft: Whereas before, your design work would have been safe, timid and measured, you now approach every design task as an award-winning design director with impeccable understanding for what makes exceptional design work: production-grade code, peak creativity, a clear POV, deep understanding of the needs of the client and users, and exceptional craft.
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
{
|
||||
"name": "impeccable",
|
||||
"description": "Design fluency for frontend development. 1 skill with 23 commands (/impeccable polish, /impeccable audit, /impeccable critique, etc.) and curated anti-pattern detection.",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.1",
|
||||
"author": {
|
||||
"name": "Paul Bakaus",
|
||||
"email": "paul@paulbakaus.com"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "impeccable",
|
||||
"description": "Design fluency for frontend development. 1 skill with 23 commands (/impeccable polish, /impeccable audit, /impeccable critique, etc.) and curated anti-pattern detection.",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.1",
|
||||
"author": {
|
||||
"name": "Paul Bakaus",
|
||||
"email": "paul@paulbakaus.com"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
argument-hint: "[shape · audit|critique · animate|bolder|colorize|delight|layout|overdrive|quieter|typeset · adapt|clarify|distill · harden|onboard|optimize|polish · init|document|extract|live] [target]"
|
||||
license: Apache 2.0
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
license: Apache 2.0
|
||||
---
|
||||
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
license: Apache 2.0
|
||||
---
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
---
|
||||
|
||||
This skill gives you the tools and permission to create design that earns to be called out-of-distribution craft: Whereas before, your design work would have been safe, timid and measured, you now approach every design task as an award-winning design director with impeccable understanding for what makes exceptional design work: production-grade code, peak creativity, a clear POV, deep understanding of the needs of the client and users, and exceptional craft.
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
argument-hint: "[shape · audit|critique · animate|bolder|colorize|delight|layout|overdrive|quieter|typeset · adapt|clarify|distill · harden|onboard|optimize|polish · init|document|extract|live] [target]"
|
||||
license: Apache 2.0
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
argument-hint: "[shape · audit|critique · animate|bolder|colorize|delight|layout|overdrive|quieter|typeset · adapt|clarify|distill · harden|onboard|optimize|polish · init|document|extract|live] [target]"
|
||||
license: Apache 2.0
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
license: Apache 2.0
|
||||
---
|
||||
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
license: Apache 2.0
|
||||
---
|
||||
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
argument-hint: "[shape · audit|critique · animate|bolder|colorize|delight|layout|overdrive|quieter|typeset · adapt|clarify|distill · harden|onboard|optimize|polish · init|document|extract|live] [target]"
|
||||
license: Apache 2.0
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
license: Apache 2.0
|
||||
allowed-tools:
|
||||
- Bash(npx impeccable *)
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
argument-hint: "[shape · audit|critique · animate|bolder|colorize|delight|layout|overdrive|quieter|typeset · adapt|clarify|distill · harden|onboard|optimize|polish · init|document|extract|live] [target]"
|
||||
license: Apache 2.0
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
argument-hint: "[shape · audit|critique · animate|bolder|colorize|delight|layout|overdrive|quieter|typeset · adapt|clarify|distill · harden|onboard|optimize|polish · init|document|extract|live] [target]"
|
||||
license: Apache 2.0
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
argument-hint: "[shape · audit|critique · animate|bolder|colorize|delight|layout|overdrive|quieter|typeset · adapt|clarify|distill · harden|onboard|optimize|polish · init|document|extract|live] [target]"
|
||||
license: Apache 2.0
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
argument-hint: "[shape · audit|critique · animate|bolder|colorize|delight|layout|overdrive|quieter|typeset · adapt|clarify|distill · harden|onboard|optimize|polish · init|document|extract|live] [target]"
|
||||
license: Apache 2.0
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
license: Apache 2.0
|
||||
---
|
||||
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
license: Apache 2.0
|
||||
allowed-tools:
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
Generated
+1
@@ -595,6 +595,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha1",
|
||||
"sha2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -20,6 +20,7 @@ serde_json = { workspace = true, features = ["preserve_order", "float_roundtrip"
|
||||
regex = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
sha1 = "0.10"
|
||||
sha2 = "0.10"
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = { workspace = true, features = ["preserve_order", "float_roundtrip"] }
|
||||
|
||||
@@ -18,7 +18,7 @@ use impeccable_comp::raster::{self as r, Image};
|
||||
use regex::Regex;
|
||||
use serde_json::{json, Map, Value};
|
||||
|
||||
use crate::comp_diff::{align_build, best_shift, build_report, compare, write_artifacts, Score};
|
||||
use crate::comp_diff::{align_build, best_shift, build_report, compare, write_artifacts, write_region_artifacts, CompareResult, Score};
|
||||
use crate::comp_spec::{load_spec, plate_reference, BUILD_DIR, SPEC_PATH};
|
||||
use crate::font_match::choice_stamped;
|
||||
use crate::util::{self, arg, flag, round, to_fixed};
|
||||
@@ -163,6 +163,7 @@ struct Gate {
|
||||
worst_crops: Vec<Value>,
|
||||
advisories: Vec<String>,
|
||||
region_verdicts: Map<String, Value>,
|
||||
region_reasons: Map<String, Value>,
|
||||
// comps: approved comp path
|
||||
approved: Option<String>,
|
||||
// plates: per-plate rows
|
||||
@@ -191,6 +192,7 @@ impl Gate {
|
||||
worst_crops: vec![],
|
||||
advisories: vec![],
|
||||
region_verdicts: Map::new(),
|
||||
region_reasons: Map::new(),
|
||||
approved: None,
|
||||
plates: None,
|
||||
error: false,
|
||||
@@ -201,6 +203,7 @@ impl Gate {
|
||||
let mut m = Map::new();
|
||||
m.insert("ok".into(), json!(self.ok));
|
||||
m.insert("reasons".into(), json!(self.reasons));
|
||||
if !self.region_reasons.is_empty() { m.insert("regionReasons".into(), json!(self.region_reasons)); }
|
||||
if let Some(s) = &self.summary {
|
||||
m.insert("summary".into(), json!(s));
|
||||
}
|
||||
@@ -477,10 +480,15 @@ fn gate_plates(io: &Io) -> Gate {
|
||||
g.plates = Some(vec![]);
|
||||
return g;
|
||||
}
|
||||
let comp = spec.get("comp").and_then(Value::as_str).and_then(|c| load_raster(io, c).ok());
|
||||
let Some(comp) = spec.get("comp").and_then(Value::as_str).and_then(|c| load_raster(io, c).ok()) else {
|
||||
let mut gate = Gate::fail(vec!["cannot validate plates: the spec's comp is missing or unreadable".into()]);
|
||||
gate.plates = Some(vec![]);
|
||||
return gate;
|
||||
};
|
||||
let mut reasons: Vec<String> = Vec::new();
|
||||
let mut plates: Vec<Value> = Vec::new();
|
||||
for rr in &raster_regions {
|
||||
let reasons_before = reasons.len();
|
||||
let id = rr.get("id").and_then(Value::as_str).unwrap_or("").to_string();
|
||||
let file = rr.get("plate").and_then(Value::as_str).map(String::from);
|
||||
let Some(file) = file.clone().filter(|f| abs(io, f).exists()) else {
|
||||
@@ -508,8 +516,9 @@ fn gate_plates(io: &Io) -> Gate {
|
||||
img.image.width, px_w as i64, round(min_w) as i64
|
||||
));
|
||||
}
|
||||
let mut score_val: Option<f64> = None;
|
||||
if let Some(comp) = &comp {
|
||||
let score_val;
|
||||
{
|
||||
let comp = ∁
|
||||
let refimg = plate_reference(comp, &spec, rr);
|
||||
// composite transparent plates over the region's sampled ground
|
||||
let mut build = img.image.clone();
|
||||
@@ -550,7 +559,10 @@ fn gate_plates(io: &Io) -> Gate {
|
||||
}
|
||||
}
|
||||
plates.push(json!({
|
||||
"id": id, "file": file, "status": "ok",
|
||||
"id": id, "file": file, "status": if reasons.len() == reasons_before { "ok" } else { "invalid" },
|
||||
"assetHash": sha256_file(io, &file),
|
||||
"regionHash": sha256_bytes(util::json_pretty(rr).as_bytes()),
|
||||
"compHash": spec.get("comp").and_then(Value::as_str).and_then(|p| sha256_file(io, p)),
|
||||
"size": format!("{}x{}", img.image.width, img.image.height),
|
||||
"score": score_val.map(util::num).unwrap_or(Value::Null)
|
||||
}));
|
||||
@@ -562,6 +574,50 @@ fn gate_plates(io: &Io) -> Gate {
|
||||
g
|
||||
}
|
||||
|
||||
fn sha256_bytes(bytes: &[u8]) -> String {
|
||||
use sha2::{Digest, Sha256};
|
||||
format!("{:x}", Sha256::digest(bytes))
|
||||
}
|
||||
|
||||
fn sha256_file(io: &Io, file: &str) -> Option<String> {
|
||||
std::fs::read(abs(io, file)).ok().map(|bytes| sha256_bytes(&bytes))
|
||||
}
|
||||
|
||||
fn save_plate_receipts(state: &mut Value, gate: &Gate) {
|
||||
if let Some(plates) = &gate.plates {
|
||||
let receipts: Map<String, Value> = plates.iter().filter_map(|p| {
|
||||
Some((p.get("id")?.as_str()?.to_string(), p.clone()))
|
||||
}).collect();
|
||||
state["plates"] = Value::Object(receipts);
|
||||
}
|
||||
}
|
||||
|
||||
fn plate_receipt_current(io: &Io, state: &Value, spec: &Value, region: &Value) -> bool {
|
||||
let Some(id) = region.get("id").and_then(Value::as_str) else { return false; };
|
||||
let Some(receipt) = state.get("plates").and_then(|p| p.get(id)) else { return false; };
|
||||
let Some(file) = region.get("plate").and_then(Value::as_str) else { return false; };
|
||||
let Some(comp) = spec.get("comp").and_then(Value::as_str) else { return false; };
|
||||
receipt.get("status").and_then(Value::as_str) == Some("ok")
|
||||
&& receipt.get("score").and_then(Value::as_f64).map(|s| s.is_finite()).unwrap_or(false)
|
||||
&& receipt.get("file").and_then(Value::as_str) == Some(file)
|
||||
&& sha256_file(io, file).as_deref().is_some_and(|h| receipt.get("assetHash").and_then(Value::as_str) == Some(h))
|
||||
&& sha256_file(io, comp).as_deref().is_some_and(|h| receipt.get("compHash").and_then(Value::as_str) == Some(h))
|
||||
&& receipt.get("regionHash").and_then(Value::as_str) == Some(sha256_bytes(util::json_pretty(region).as_bytes()).as_str())
|
||||
}
|
||||
|
||||
fn revalidate_plates(io: &Io, state: &mut Value, spec: Option<&Value>) -> Option<Gate> {
|
||||
let spec = spec?;
|
||||
let stale = spec_regions(spec).iter()
|
||||
.filter(|r| r.get("medium").and_then(Value::as_str) == Some("raster"))
|
||||
.any(|r| !plate_receipt_current(io, state, spec, r));
|
||||
if stale {
|
||||
let gate = gate_plates(io);
|
||||
save_plate_receipts(state, &gate);
|
||||
if !gate.ok { return Some(gate); }
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn hex_rgba(hex: &str) -> Option<[u8; 4]> {
|
||||
let re = regex_hex();
|
||||
let caps = re.captures(hex)?;
|
||||
@@ -919,6 +975,7 @@ struct HeroReadings {
|
||||
chrome: Vec<String>,
|
||||
plates: Vec<String>,
|
||||
invented: Value,
|
||||
region_ids: std::collections::HashMap<String, Vec<String>>,
|
||||
}
|
||||
|
||||
fn hero_readings(io: &Io, state: &Value, spec: Option<&Value>, build_path: &str) -> Option<HeroReadings> {
|
||||
@@ -936,7 +993,9 @@ fn hero_readings(io: &Io, state: &Value, spec: Option<&Value>, build_path: &str)
|
||||
let mut text: Vec<String> = Vec::new();
|
||||
let mut chrome: Vec<String> = Vec::new();
|
||||
let mut plates: Vec<String> = Vec::new();
|
||||
let mut region_ids = std::collections::HashMap::<String, Vec<String>>::new();
|
||||
for rr in spec_regions(spec) {
|
||||
let starts = (text.len(), chrome.len(), plates.len());
|
||||
let px = rr.get("px");
|
||||
if px.is_none() {
|
||||
continue;
|
||||
@@ -979,9 +1038,12 @@ fn hero_readings(io: &Io, state: &Value, spec: Option<&Value>, build_path: &str)
|
||||
));
|
||||
}
|
||||
}
|
||||
for message in text[starts.0..].iter().chain(chrome[starts.1..].iter()).chain(plates[starts.2..].iter()) {
|
||||
region_ids.entry(message.clone()).or_default().push(region.id.clone());
|
||||
}
|
||||
}
|
||||
let invented = invented_ink(&comp, &aligned);
|
||||
Some(HeroReadings { text, chrome, plates, invented })
|
||||
Some(HeroReadings { text, chrome, plates, invented, region_ids })
|
||||
}
|
||||
|
||||
// ---- hero gate -------------------------------------------------------------
|
||||
@@ -1001,11 +1063,11 @@ fn rscore_opt(r: &Value, k: &str) -> Option<f64> {
|
||||
}
|
||||
|
||||
/// Run comp-diff in-process (JS spawned comp-diff.mjs --json), returning its report.
|
||||
fn hero_diff(io: &Io, comp_path: &str, build_path: &str, spec: Option<&Value>, out_dir: &str) -> Result<Value, String> {
|
||||
fn hero_diff(io: &Io, comp_path: &str, build_path: &str, spec: Option<&Value>, out_dir: &str) -> Result<(Value, CompareResult), String> {
|
||||
let comp = load_raster(io, comp_path)?;
|
||||
let build = load_raster(io, build_path)?;
|
||||
let res = compare(&comp, &build, spec, "top", "hero", None);
|
||||
let files = write_artifacts(&res, &comp, &abs(io, out_dir));
|
||||
let files = write_artifacts(&res, &comp, &abs(io, out_dir)).map_err(|e| format!("cannot persist comparison artifacts: {e}"))?;
|
||||
let meta = json!({
|
||||
"label": "hero",
|
||||
"comp": comp_path,
|
||||
@@ -1015,18 +1077,148 @@ fn hero_diff(io: &Io, comp_path: &str, build_path: &str, spec: Option<&Value>, o
|
||||
"buildSize": format!("{}x{}", build.width, build.height),
|
||||
});
|
||||
let report = build_report(&res, Some(&files), &meta);
|
||||
let _ = std::fs::write(abs(io, &format!("{out_dir}/report.json")), util::json_pretty(&report));
|
||||
Ok(report)
|
||||
|
||||
Ok((report, res))
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &str, artifact: Option<&str>, organic_scan: OrganicScan) -> Gate {
|
||||
let pending = Gate::fail(vec!["hero comparison has not completed".into()]);
|
||||
if let Err(e) = unavailable_report(io, out_dir, &pending, "hero") {
|
||||
return Gate::fail(vec![format!("cannot persist hero gate evidence: {e}")]);
|
||||
}
|
||||
let mut gate = gate_hero_inner(io, state, build_path, min, out_dir, artifact, organic_scan);
|
||||
if gate.report.is_none() {
|
||||
if let Err(e) = unavailable_report(io, out_dir, &gate, "hero") {
|
||||
gate.ok = false;
|
||||
gate.reasons.push(format!("cannot persist hero gate evidence: {e}"));
|
||||
}
|
||||
}
|
||||
gate
|
||||
}
|
||||
|
||||
fn atomic_report(path: &Path, report: &Value) -> Result<(), String> {
|
||||
static NEXT: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
|
||||
let temp = path.with_extension(format!("tmp-{}-{}", std::process::id(), NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed)));
|
||||
let result = (|| {
|
||||
if let Some(parent) = path.parent() { std::fs::create_dir_all(parent)?; }
|
||||
std::fs::write(&temp, util::json_pretty(report))?;
|
||||
std::fs::rename(&temp, path)
|
||||
})();
|
||||
if result.is_err() { let _ = std::fs::remove_file(temp); }
|
||||
result.map_err(|e: std::io::Error| e.to_string())
|
||||
}
|
||||
|
||||
fn unavailable_report(io: &Io, out_dir: &str, gate: &Gate, phase: &str) -> Result<(), String> {
|
||||
let mut report = json!({ "interpretation": format!("{phase}-gate"), "measurementsAvailable": false,
|
||||
"regions": [], "gate": { "ok": false, "reasons": gate.reasons,
|
||||
"advisories": gate.advisories, "unscopedReasons": gate.reasons } });
|
||||
// Invalidate the report before touching images; also clean partial writes on failure.
|
||||
// Attempt cleanup even when the report itself cannot be replaced.
|
||||
let report_write = atomic_report(&abs(io, &format!("{out_dir}/report.json")), &report);
|
||||
let cleanup = clear_comparison_artifacts(&abs(io, out_dir));
|
||||
if let Err(error) = &cleanup {
|
||||
// A read-only regions directory may prevent unlinking its children even
|
||||
// when its parent permits moving the directory. Preserve those bytes as
|
||||
// explicitly invalid evidence instead of leaving them at current paths.
|
||||
report["artifactCleanup"] = json!({"status":"failed", "error":error,
|
||||
"invalidArtifacts":["raw-report.json", "side-by-side.png", "heatmap.png", "regions/"]});
|
||||
match quarantine_comparison_artifacts(&abs(io, out_dir)) {
|
||||
Ok(record) => report["artifactCleanup"]["quarantine"] = record,
|
||||
Err(e) => report["artifactCleanup"]["quarantineError"] = json!(e),
|
||||
}
|
||||
// If the filesystem also refuses quarantine, the report explicitly marks
|
||||
// every potentially remaining artifact invalid. The gate still fails.
|
||||
atomic_report(&abs(io, &format!("{out_dir}/report.json")), &report)?;
|
||||
}
|
||||
report_write.and(cleanup)
|
||||
}
|
||||
|
||||
fn quarantine_comparison_artifacts(out_dir: &Path) -> Result<Value, String> {
|
||||
static NEXT: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
|
||||
let quarantine = loop {
|
||||
let candidate = out_dir.join(format!("invalid-comparison-{}-{}", std::process::id(), NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed)));
|
||||
match std::fs::create_dir(&candidate) {
|
||||
Ok(()) => break candidate,
|
||||
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => continue,
|
||||
Err(e) => return Err(e.to_string()),
|
||||
}
|
||||
};
|
||||
let mut errors = Vec::new();
|
||||
let mut artifacts = Map::new();
|
||||
let prefix = quarantine.file_name().unwrap().to_string_lossy();
|
||||
for name in ["raw-report.json", "side-by-side.png", "heatmap.png", "regions"] {
|
||||
let path = out_dir.join(name);
|
||||
// Keep the same parent: moving a read-only directory into another parent
|
||||
// can require write permission on that directory (to change its `..`).
|
||||
let target = out_dir.join(format!("{prefix}-{name}"));
|
||||
let move_artifact = (|| -> std::io::Result<()> {
|
||||
match std::fs::symlink_metadata(&target) {
|
||||
Ok(_) => return Err(std::io::Error::new(std::io::ErrorKind::AlreadyExists, "quarantine target exists")),
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => (),
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
std::fs::rename(&path, &target)
|
||||
})();
|
||||
match move_artifact {
|
||||
Ok(()) => { artifacts.insert(name.into(), json!(target.to_string_lossy().replace('\\', "/"))); },
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => (),
|
||||
Err(e) => errors.push(format!("{name}: {e}")),
|
||||
}
|
||||
}
|
||||
let record = json!({"invalid":true, "artifacts":artifacts, "errors":errors});
|
||||
atomic_report(&quarantine.join("manifest.json"), &record)?;
|
||||
Ok(record)
|
||||
}
|
||||
|
||||
fn clear_comparison_artifacts(out_dir: &Path) -> Result<(), String> {
|
||||
// Only remove generated files. Never recursively delete a caller's output directory
|
||||
// or follow a regions symlink into another directory. Unexpected directories at
|
||||
// file paths remain obstructions: the subsequent writer must still fail closed.
|
||||
fn remove_file(path: &Path) -> std::io::Result<()> {
|
||||
match std::fs::symlink_metadata(path) {
|
||||
Ok(meta) if !meta.is_dir() => std::fs::remove_file(path),
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
let mut errors = Vec::new();
|
||||
for name in ["raw-report.json", "side-by-side.png", "heatmap.png"] {
|
||||
if let Err(e) = remove_file(&out_dir.join(name)) { errors.push(format!("{name}: {e}")); }
|
||||
}
|
||||
fn clear_regions(path: &Path, errors: &mut Vec<String>) -> std::io::Result<()> {
|
||||
let meta = match std::fs::symlink_metadata(path) {
|
||||
Ok(meta) => meta,
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(()),
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
if meta.file_type().is_symlink() { return std::fs::remove_file(path); }
|
||||
if meta.is_dir() {
|
||||
for entry in std::fs::read_dir(path)? {
|
||||
let child = entry?.path();
|
||||
if let Err(e) = clear_regions(&child, errors) { errors.push(format!("{}: {e}", child.display())); }
|
||||
}
|
||||
} else if path.extension().and_then(|ext| ext.to_str()) == Some("png") {
|
||||
std::fs::remove_file(path)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
if let Err(e) = clear_regions(&out_dir.join("regions"), &mut errors) { errors.push(format!("regions: {e}")); }
|
||||
if errors.is_empty() { Ok(()) } else { Err(format!("cannot clear comparison artifacts: {}", errors.join("; "))) }
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn gate_hero_inner(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &str, artifact: Option<&str>, organic_scan: OrganicScan) -> Gate {
|
||||
let s = self_cmd(io);
|
||||
if !abs(io, build_path).exists() {
|
||||
let bp = state.get("breakpoint").and_then(Value::as_str).map(String::from).unwrap_or_else(|| "comp size".into());
|
||||
return Gate::fail(vec![format!("no hero capture at {build_path}: screenshot the first viewport at the comp's own dimensions ({bp}) into that path")]);
|
||||
}
|
||||
let spec_gate = gate_spec(io, state);
|
||||
if !spec_gate.ok { return spec_gate; }
|
||||
let spec_for_refs = load_spec(&abs(io, SPEC_PATH));
|
||||
if let Some(failure) = revalidate_plates(io, state, spec_for_refs.as_ref()) { return failure; }
|
||||
// resolve the page
|
||||
let mut page_file: Option<String> = artifact.map(String::from).or_else(|| state.get("artifact").and_then(Value::as_str).map(String::from));
|
||||
if page_file.as_ref().map(|p| !abs(io, p).exists()).unwrap_or(true) {
|
||||
@@ -1062,13 +1254,14 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
);
|
||||
}
|
||||
let comp_path = state.get("comp").and_then(Value::as_str).unwrap_or("").to_string();
|
||||
let report = match hero_diff(io, &comp_path, build_path, spec_for_refs.as_ref(), out_dir) {
|
||||
let (mut report, mut measured) = match hero_diff(io, &comp_path, build_path, spec_for_refs.as_ref(), out_dir) {
|
||||
Ok(r) => r,
|
||||
Err(e) => return Gate::fail(vec![format!("comp-diff failed: {e}")]),
|
||||
};
|
||||
let mut regions: Vec<Value> = report.get("regions").and_then(Value::as_array).cloned().unwrap_or_default();
|
||||
let mut reasons: Vec<String> = Vec::new();
|
||||
let mut advisories: Vec<String> = Vec::new();
|
||||
let mut region_reasons = Map::new();
|
||||
let overall = report.get("overall").and_then(Value::as_f64).unwrap_or(0.0);
|
||||
let sc = |k: &str| report.pointer(&format!("/scores/{k}")).and_then(Value::as_f64).unwrap_or(0.0);
|
||||
// capture-frame check
|
||||
@@ -1145,21 +1338,19 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
});
|
||||
if ink_present {
|
||||
r["verdict"] = json!("drift");
|
||||
r["verdictReason"] = json!("texture with overlapping code-drawn ink present");
|
||||
} else {
|
||||
missing_ids.push(id);
|
||||
}
|
||||
}
|
||||
// passed-plate placement notes
|
||||
let passed_plate = |id: &str| -> bool {
|
||||
state
|
||||
.pointer(&format!("/plates/{id}"))
|
||||
.map(|p| {
|
||||
p.get("status").and_then(Value::as_str) == Some("ok")
|
||||
&& p.get("score").map(|s| s.is_null() || s.as_f64().map(|v| v >= PLATE_MIN).unwrap_or(false)).unwrap_or(true)
|
||||
})
|
||||
spec_regions_v.iter().find(|r| r.get("id").and_then(Value::as_str) == Some(id))
|
||||
.map(|r| spec_for_refs.as_ref().is_some_and(|spec| plate_receipt_current(io, state, spec, r))
|
||||
&& state.get("plates").and_then(|p| p.get(id)).and_then(|p| p.get("score")).and_then(Value::as_f64).is_some_and(|s| s >= PLATE_MIN))
|
||||
.unwrap_or(false)
|
||||
};
|
||||
let mut placement_notes: Vec<String> = Vec::new();
|
||||
let mut placement_notes: Vec<(String, String)> = Vec::new();
|
||||
for r in regions.iter_mut() {
|
||||
let kind = r.get("kind").and_then(Value::as_str).unwrap_or("").to_string();
|
||||
let id = r.get("id").and_then(Value::as_str).unwrap_or("").to_string();
|
||||
@@ -1180,6 +1371,7 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
}
|
||||
r["verdict"] = json!("drift");
|
||||
r["placed"] = json!(true);
|
||||
r["verdictReason"] = json!("current plate passed asset validation and rendered presence check; placement remains reviewable");
|
||||
let ic = r.pointer("/inkBox/comp").cloned().unwrap_or(Value::Null);
|
||||
let ib = r.pointer("/inkBox/build").cloned().unwrap_or(Value::Null);
|
||||
if !ic.is_null() && !ib.is_null() {
|
||||
@@ -1188,28 +1380,28 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
let (bw_, bh_, bx, by) = (cf(&ib, "w"), cf(&ib, "h"), cf(&ib, "x"), cf(&ib, "y"));
|
||||
let off = (bw_ - cw_).abs() > cw_ * 0.2 || (bh_ - ch_).abs() > ch_ * 0.2 || (bx - cx).abs() > cw_ * 0.15 || (by - cy).abs() > ch_ * 0.15;
|
||||
if off {
|
||||
placement_notes.push(format!(
|
||||
placement_notes.push((id.to_string(), format!(
|
||||
"plate {id} is placed but not at the comp's box: its ink spans {}x{}px at ({},{}) in the comp region and {}x{}px at ({},{}) in the build; size and position the <img> to the spec box (object-fit: cover), not to the surrounding layout",
|
||||
cw_ as i64, ch_ as i64, cx as i64, cy as i64, bw_ as i64, bh_ as i64, bx as i64, by as i64
|
||||
));
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
for id in &missing_ids {
|
||||
if let Some(r) = regions.iter().find(|r| r.get("id").and_then(Value::as_str) == Some(id.as_str())) {
|
||||
if r.get("verdict").and_then(Value::as_str) == Some("missing") {
|
||||
reasons.push(format!(
|
||||
push_region_blocker(&mut reasons, &mut region_reasons, id, format!(
|
||||
"region {id} is missing (detail {}%, structure {}%): the comp shows material the build does not",
|
||||
pct0(rscore(r, "detail")), pct0(rscore(r, "structure"))
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
for n in placement_notes {
|
||||
for (id, n) in placement_notes {
|
||||
if above_bar {
|
||||
advisories.push(format!("(advisory, above the {}% bar) {n}", pct0(min)));
|
||||
} else {
|
||||
reasons.push(n);
|
||||
push_region_blocker(&mut reasons, &mut region_reasons, &id, n);
|
||||
}
|
||||
}
|
||||
// contradicted
|
||||
@@ -1229,7 +1421,7 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
} else {
|
||||
format!("the plate here does not read as the comp region; regenerate it with the crop as reference ({s} generate-image --ref <crop.png> --prompt-file <prompt.txt> --out <plate.png> for {id}) and place it at its box")
|
||||
};
|
||||
reasons.push(format!(
|
||||
push_region_blocker(&mut reasons, &mut region_reasons, id, format!(
|
||||
"region {id} ({kind}) is contradicted (structure {}%, detail added {}%): {tail}",
|
||||
pct0(rscore(r, "structure")), pct0(rscore(r, "detailAdded"))
|
||||
));
|
||||
@@ -1239,7 +1431,7 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
continue;
|
||||
}
|
||||
let id = r.get("id").and_then(Value::as_str).unwrap_or("");
|
||||
reasons.push(format!(
|
||||
push_region_blocker(&mut reasons, &mut region_reasons, id, format!(
|
||||
"control {id} drifts to {}% (structure {}%, color {}%): its chrome differs from the comp's; open {} and match the border, fill, radius, chevron or arrow, and label size",
|
||||
pct0(rscore(r, "overall")), pct0(rscore(r, "structure")), pct0(rscore(r, "color")),
|
||||
format!("{out_dir}/regions/{id}.png")
|
||||
@@ -1279,19 +1471,23 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
if above_bar {
|
||||
advisories.push(format!("(advisory, above the {}% bar) {msg}", pct0(min)));
|
||||
} else {
|
||||
reasons.push(msg);
|
||||
push_region_blocker(&mut reasons, &mut region_reasons, r.get("id").and_then(Value::as_str).unwrap_or(""), msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
let other_contradicted: Vec<&Value> = contradicted.iter().filter(|r| !direction_contradicted.iter().any(|d| d.get("id") == r.get("id"))).collect();
|
||||
let allow = 1usize.max(regions.len() / 3);
|
||||
if other_contradicted.len() > allow {
|
||||
reasons.push(format!(
|
||||
let message = format!(
|
||||
"{} of {} regions contradicted: {}",
|
||||
other_contradicted.len(),
|
||||
regions.len(),
|
||||
other_contradicted.iter().filter_map(|r| r.get("id").and_then(Value::as_str)).collect::<Vec<_>>().join(", ")
|
||||
));
|
||||
);
|
||||
for r in &other_contradicted {
|
||||
if let Some(id) = r.get("id").and_then(Value::as_str) { record_region_reason(&mut region_reasons, id, &message); }
|
||||
}
|
||||
reasons.push(message);
|
||||
}
|
||||
// organic clip + svg illustrations
|
||||
let artifact_file = page_file.clone();
|
||||
@@ -1300,7 +1496,7 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
for o in organic_clip_regions(io, af, spec, organic_scan) {
|
||||
let id = o.get("id").and_then(Value::as_str).unwrap_or("");
|
||||
let snip = o.get("snippet").and_then(Value::as_str).unwrap_or("");
|
||||
reasons.push(format!("artifact draws an organic clip-path ({snip}) inside raster region {id}'s box; that region ships as its plate, never as a polygon"));
|
||||
push_region_blocker(&mut reasons, &mut region_reasons, id, format!("artifact draws an organic clip-path ({snip}) inside raster region {id}'s box; that region ships as its plate, never as a polygon"));
|
||||
}
|
||||
let svgs = std::fs::read_to_string(abs(io, af)).map(|h| svg_illustrations(&h)).unwrap_or_default();
|
||||
for v in svgs.iter().take(6) {
|
||||
@@ -1323,7 +1519,6 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
if let Some(readings) = readings {
|
||||
use once_cell::sync::Lazy;
|
||||
static FOLD: Lazy<regex::Regex> = Lazy::new(|| Regex::new(r"(?i)^text ([a-z0-9]+(?:-[a-z0-9]+)*?)(?:-(?:\d+|[a-z]))?: (cap height|\d+ lines? in the build|the face renders|ink is|its first line|it starts|line pitch)").unwrap());
|
||||
static IDM: Lazy<regex::Regex> = Lazy::new(|| Regex::new(r"^text ([^:]+):").unwrap());
|
||||
static CAP: Lazy<regex::Regex> = Lazy::new(|| Regex::new(r"cap height").unwrap());
|
||||
static LINES: Lazy<regex::Regex> = Lazy::new(|| Regex::new(r"lines? in the build").unwrap());
|
||||
static HEAV: Lazy<regex::Regex> = Lazy::new(|| Regex::new(r"heavier|lighter").unwrap());
|
||||
@@ -1332,7 +1527,8 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
let order = |f: &str| -> u8 {
|
||||
if CAP.is_match(f) { 0 } else if LINES.is_match(f) { 1 } else if HEAV.is_match(f) { 2 } else if INKIS.is_match(f) { 3 } else { 4 }
|
||||
};
|
||||
// fold sibling text findings
|
||||
// Keep region provenance when sibling text findings are folded.
|
||||
let mut reading_ids = readings.region_ids.clone();
|
||||
let mut folded: Vec<(String, String, Vec<String>)> = Vec::new(); // (key, first, ids)
|
||||
for f in &readings.text {
|
||||
let key = if let Some(m) = FOLD.captures(f) {
|
||||
@@ -1340,24 +1536,21 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
} else {
|
||||
f.clone()
|
||||
};
|
||||
let idm = IDM.captures(f).map(|m| m[1].to_string());
|
||||
let ids = readings.region_ids.get(f).cloned().unwrap_or_default();
|
||||
if let Some(entry) = folded.iter_mut().find(|(k, _, _)| *k == key) {
|
||||
if let Some(id) = idm {
|
||||
entry.2.push(id);
|
||||
}
|
||||
entry.2.extend(ids);
|
||||
} else {
|
||||
let ids = idm.map(|id| vec![id]).unwrap_or_default();
|
||||
folded.push((key, f.clone(), ids));
|
||||
}
|
||||
}
|
||||
let mut text: Vec<String> = folded
|
||||
.into_iter()
|
||||
.map(|(_, first, ids)| {
|
||||
if ids.len() > 1 {
|
||||
let message = if ids.len() > 1 {
|
||||
format!("{first} (also {})", ids[1..].join(", "))
|
||||
} else {
|
||||
first
|
||||
}
|
||||
} else { first };
|
||||
reading_ids.insert(message.clone(), ids);
|
||||
message
|
||||
})
|
||||
.collect();
|
||||
text.sort_by_key(|a| order(a));
|
||||
@@ -1397,19 +1590,15 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
advisories.push(format!(" {f}"));
|
||||
}
|
||||
} else {
|
||||
if !kept.is_empty() {
|
||||
let of = if fresh.len() > kept.len() { format!("{} of {}, the rest after these", kept.len(), fresh.len()) } else { format!("{}", kept.len()) };
|
||||
reasons.push(format!("READINGS, each one CSS edit ({of}):"));
|
||||
}
|
||||
for f in &kept {
|
||||
reasons.push(f.clone());
|
||||
push_reading_blocker(&mut reasons, &mut region_reasons, &reading_ids, f);
|
||||
}
|
||||
}
|
||||
for f in &advisory_stale {
|
||||
advisories.push(format!("(advisory, unchanged for 3+ attempts) {f}"));
|
||||
}
|
||||
for f in &readings.plates {
|
||||
reasons.push(f.clone());
|
||||
push_reading_blocker(&mut reasons, &mut region_reasons, &reading_ids, f);
|
||||
}
|
||||
let cells = readings.invented.get("cells").and_then(Value::as_array).cloned().unwrap_or_default();
|
||||
let fraction = readings.invented.get("fraction").and_then(Value::as_f64).unwrap_or(0.0);
|
||||
@@ -1425,13 +1614,13 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
}
|
||||
}
|
||||
// worst regions
|
||||
let mut worst_sorted = regions.clone();
|
||||
worst_sorted.sort_by(|a, b| rscore(a, "overall").partial_cmp(&rscore(b, "overall")).unwrap());
|
||||
let worst_sorted = repair_regions(®ions, ®ion_reasons);
|
||||
let worst_top: Vec<&Value> = worst_sorted.iter().take(3).collect();
|
||||
let region_dir = format!("{out_dir}/regions");
|
||||
let mut g = Gate::blank();
|
||||
g.ok = reasons.is_empty();
|
||||
g.reasons = reasons;
|
||||
g.region_reasons = region_reasons;
|
||||
g.summary = Some(format!("hero {}% ({})", pct0(overall), report.get("verdict").and_then(Value::as_str).unwrap_or("")));
|
||||
g.score = Some(overall);
|
||||
g.verdict = report.get("verdict").and_then(Value::as_str).map(String::from);
|
||||
@@ -1454,18 +1643,90 @@ fn gate_hero(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dir: &s
|
||||
.iter()
|
||||
.filter_map(|r| Some((r.get("id")?.as_str()?.to_string(), json!(r.get("verdict")?.as_str()?))))
|
||||
.collect();
|
||||
publish_gate_evidence(io, out_dir, &mut report, &mut measured, ®ions, &mut g, "hero");
|
||||
|
||||
g
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn publish_gate_evidence(io: &Io, out_dir: &str, report: &mut Value, measured: &mut CompareResult, regions: &[Value], g: &mut Gate, phase: &str) {
|
||||
let raw_path = format!("{out_dir}/raw-report.json");
|
||||
let raw = report.clone();
|
||||
g.report = Some(format!("{out_dir}/report.json"));
|
||||
apply_gate_evidence(report, measured, regions, g);
|
||||
report["interpretation"] = json!(format!("{phase}-gate"));
|
||||
report["rawReport"] = json!(raw_path);
|
||||
let evidence_write = (|| {
|
||||
atomic_report(&abs(io, &raw_path), &raw)?;
|
||||
write_region_artifacts(measured, &abs(io, out_dir), report.get("regions").and_then(Value::as_array).map(Vec::as_slice))?;
|
||||
atomic_report(&abs(io, &format!("{out_dir}/report.json")), report)
|
||||
})();
|
||||
if let Err(e) = evidence_write {
|
||||
g.ok = false;
|
||||
g.reasons.push(format!("cannot persist {phase} gate evidence: {e}"));
|
||||
g.report = None;
|
||||
g.side_by_side = None;
|
||||
g.worst_crops.clear();
|
||||
}
|
||||
}
|
||||
|
||||
fn push_region_blocker(reasons: &mut Vec<String>, regions: &mut Map<String, Value>, id: &str, message: String) {
|
||||
record_region_reason(regions, id, &message);
|
||||
reasons.push(message);
|
||||
}
|
||||
|
||||
fn record_region_reason(regions: &mut Map<String, Value>, id: &str, message: &str) {
|
||||
regions.entry(id.to_string()).or_insert_with(|| json!([])).as_array_mut().unwrap().push(json!(message));
|
||||
}
|
||||
|
||||
fn push_reading_blocker(reasons: &mut Vec<String>, regions: &mut Map<String, Value>, ids: &std::collections::HashMap<String, Vec<String>>, message: &str) {
|
||||
for id in ids.get(message).into_iter().flatten() { record_region_reason(regions, id, message); }
|
||||
reasons.push(message.to_string());
|
||||
}
|
||||
|
||||
fn repair_regions(regions: &[Value], blockers: &Map<String, Value>) -> Vec<Value> {
|
||||
let mut ordered: Vec<Value> = regions.iter().filter(|region| {
|
||||
region.get("id").and_then(Value::as_str).is_some_and(|id|
|
||||
blockers.get(id).and_then(Value::as_array).is_some_and(|reasons| !reasons.is_empty()))
|
||||
}).cloned().collect();
|
||||
ordered.sort_by(|a, b| rscore(a, "overall").total_cmp(&rscore(b, "overall")));
|
||||
ordered
|
||||
}
|
||||
|
||||
/// Raw scores never change during interpretation. Only gate verdicts and their
|
||||
/// basis are published alongside them; the original report is retained separately.
|
||||
fn apply_gate_evidence(report: &mut Value, measured: &mut CompareResult, regions: &[Value], gate: &Gate) {
|
||||
let unscoped: Vec<&String> = gate.reasons.iter().filter(|reason| {
|
||||
!gate.region_reasons.values().any(|v| v.as_array().is_some_and(|a| a.iter().any(|m| m.as_str() == Some(reason.as_str()))))
|
||||
}).collect();
|
||||
let mut effective = regions.to_vec();
|
||||
for region in &mut effective {
|
||||
let id = region.get("id").and_then(Value::as_str).unwrap_or("").to_string();
|
||||
let blockers = gate.region_reasons.get(&id).cloned().unwrap_or_else(|| json!([]));
|
||||
region["blocking"] = if !blockers.as_array().unwrap().is_empty() { json!(true) } else if unscoped.is_empty() { json!(false) } else { Value::Null };
|
||||
region["blockingReasons"] = blockers;
|
||||
if let Some(raw) = measured.regions.iter_mut().find(|r| r.id == id) {
|
||||
region["rawVerdict"] = json!(raw.verdict);
|
||||
if let Some(verdict) = region.get("verdict").and_then(Value::as_str) {
|
||||
raw.verdict = verdict.into();
|
||||
}
|
||||
}
|
||||
}
|
||||
report["regions"] = json!(effective);
|
||||
report["interpretation"] = json!("hero-gate");
|
||||
report["measurementsAvailable"] = json!(true);
|
||||
report["gate"] = json!({ "ok": gate.ok, "reasons": gate.reasons, "advisories": gate.advisories, "unscopedReasons": unscoped });
|
||||
}
|
||||
|
||||
/// JS: heroLoopVerdict(state, gate, artifactPath).
|
||||
fn hero_loop_verdict(state: &mut Value, gate: &Gate, artifact_path: &str, io: &Io) -> Option<String> {
|
||||
let s = self_cmd(io);
|
||||
let hero = state.pointer_mut("/phases/hero")?.as_object_mut()?;
|
||||
let mut history: Vec<Value> = hero.get("history").and_then(Value::as_array).cloned().unwrap_or_default();
|
||||
let entry = json!({
|
||||
"at": now(),
|
||||
"score": gate.score.map(util::num).unwrap_or(Value::Null),
|
||||
"worstIds": gate.worst_ids,
|
||||
"blockingReasons": gate.reasons,
|
||||
"regionVerdicts": Value::Object(gate.region_verdicts.clone()),
|
||||
"artifactHash": hash_file(io, artifact_path).map(Value::from).unwrap_or(Value::Null),
|
||||
});
|
||||
@@ -1477,16 +1738,11 @@ fn hero_loop_verdict(state: &mut Value, gate: &Gate, artifact_path: &str, io: &I
|
||||
return None;
|
||||
}
|
||||
let last3 = &history[history.len() - 3..];
|
||||
let first_worst = last3[0].pointer("/worstIds/0").and_then(Value::as_str);
|
||||
let stuck = first_worst.is_some() && last3.iter().all(|h| h.pointer("/worstIds/0").and_then(Value::as_str) == first_worst);
|
||||
let scores: Vec<f64> = last3.iter().map(|h| h.get("score").and_then(Value::as_f64).unwrap_or(0.0)).collect();
|
||||
let no_progress = scores.iter().cloned().fold(f64::MIN, f64::max) - scores.iter().cloned().fold(f64::MAX, f64::min) < 0.03;
|
||||
if stuck && no_progress {
|
||||
let w = first_worst.unwrap();
|
||||
return Some(format!(
|
||||
"region {w} has been the worst region for three attempts and the score moved less than 3 points: value edits are not reaching it. Open {} and rebuild that region from the comp crop (place its plate, or produce one with {s} generate-image --ref <crop.png> --prompt-file <prompt.txt> --out <plate.png>, or re-derive its structure from the spec box), then recapture.",
|
||||
format!(".impeccable/review/diff/hero/regions/{w}.png")
|
||||
));
|
||||
let current = json!(gate.reasons);
|
||||
let stuck = !gate.ok && !gate.reasons.is_empty()
|
||||
&& last3.iter().all(|h| h.get("blockingReasons") == Some(¤t));
|
||||
if stuck {
|
||||
return Some("The same hero gate checks remain unresolved after three attempts. The blocking reasons below still apply.".into());
|
||||
}
|
||||
None
|
||||
}
|
||||
@@ -1500,7 +1756,22 @@ fn hash_file(io: &Io, file: &str) -> Option<String> {
|
||||
Some(d.iter().map(|b| format!("{b:02x}")).collect::<String>()[..12].to_string())
|
||||
}
|
||||
|
||||
fn gate_responsive(io: &Io, state: &Value, min: f64, out_dir: &str) -> Gate {
|
||||
fn gate_responsive(io: &Io, state: &mut Value, min: f64, out_dir: &str) -> Gate {
|
||||
let pending = Gate::fail(vec!["responsive comparison has not completed".into()]);
|
||||
if let Err(e) = unavailable_report(io, out_dir, &pending, "responsive") {
|
||||
return Gate::fail(vec![format!("cannot persist responsive gate evidence: {e}")]);
|
||||
}
|
||||
let mut gate = gate_responsive_inner(io, state, min, out_dir);
|
||||
if gate.report.is_none() {
|
||||
if let Err(e) = unavailable_report(io, out_dir, &gate, "responsive") {
|
||||
gate.ok = false;
|
||||
gate.reasons.push(format!("cannot persist responsive gate evidence: {e}"));
|
||||
}
|
||||
}
|
||||
gate
|
||||
}
|
||||
|
||||
fn gate_responsive_inner(io: &Io, state: &mut Value, min: f64, out_dir: &str) -> Gate {
|
||||
let desktop = ".impeccable/review/desktop.png";
|
||||
let mobile = ".impeccable/review/mobile.png";
|
||||
let mut reasons = Vec::new();
|
||||
@@ -1513,21 +1784,25 @@ fn gate_responsive(io: &Io, state: &Value, min: f64, out_dir: &str) -> Gate {
|
||||
if !reasons.is_empty() {
|
||||
return Gate::fail(reasons);
|
||||
}
|
||||
let spec_gate = gate_spec(io, state);
|
||||
if !spec_gate.ok { return spec_gate; }
|
||||
let spec = load_spec(&abs(io, SPEC_PATH));
|
||||
if let Some(failure) = revalidate_plates(io, state, spec.as_ref()) { return failure; }
|
||||
let comp_path = state.get("comp").and_then(Value::as_str).unwrap_or("");
|
||||
let report = match hero_diff_labeled(io, comp_path, desktop, spec.as_ref(), out_dir, "desktop") {
|
||||
let (mut report, mut measured) = match hero_diff_labeled(io, comp_path, desktop, spec.as_ref(), out_dir, "desktop") {
|
||||
Ok(r) => r,
|
||||
Err(e) => return Gate::fail(vec![format!("comp-diff failed on {desktop}: {e}")]),
|
||||
};
|
||||
let regions: Vec<Value> = report.get("regions").and_then(Value::as_array).cloned().unwrap_or_default();
|
||||
let missing: Vec<&Value> = regions
|
||||
let mut regions: Vec<Value> = report.get("regions").and_then(Value::as_array).cloned().unwrap_or_default();
|
||||
let missing: Vec<Value> = regions
|
||||
.iter()
|
||||
.filter(|r| {
|
||||
if r.get("verdict").and_then(Value::as_str) != Some("missing") || r.get("kind").and_then(Value::as_str) == Some("texture") {
|
||||
return false;
|
||||
}
|
||||
let id = r.get("id").and_then(Value::as_str).unwrap_or("");
|
||||
let passed = state.pointer(&format!("/plates/{id}/status")).and_then(Value::as_str) == Some("ok");
|
||||
let passed = spec.as_ref().is_some_and(|spec| spec_regions(spec).iter().any(|region|
|
||||
region.get("id").and_then(Value::as_str) == Some(id) && plate_receipt_current(io, state, spec, region)));
|
||||
let kind = r.get("kind").and_then(Value::as_str).unwrap_or("");
|
||||
if (kind == "plate" || kind == "image") && passed {
|
||||
let present = rscore_opt(r, "detailRaw").map(|v| v >= 0.3).unwrap_or(rscore(r, "detail") >= 0.3);
|
||||
@@ -1537,8 +1812,17 @@ fn gate_responsive(io: &Io, state: &Value, min: f64, out_dir: &str) -> Gate {
|
||||
}
|
||||
true
|
||||
})
|
||||
.collect();
|
||||
let contradicted_direction: Vec<&Value> = regions.iter().filter(|r| r.get("verdict").and_then(Value::as_str) == Some("contradicted") && r.get("kind").and_then(Value::as_str) == Some("text")).collect();
|
||||
.cloned().collect();
|
||||
let contradicted_direction: Vec<Value> = regions.iter().filter(|r| r.get("verdict").and_then(Value::as_str) == Some("contradicted") && r.get("kind").and_then(Value::as_str) == Some("text")).cloned().collect();
|
||||
for region in &mut regions {
|
||||
if region.get("verdict").and_then(Value::as_str) == Some("missing")
|
||||
&& matches!(region.get("kind").and_then(Value::as_str), Some("plate" | "image"))
|
||||
&& !missing.iter().any(|r| r.get("id") == region.get("id")) {
|
||||
region["verdict"] = json!("drift");
|
||||
region["verdictReason"] = json!("current plate passed asset validation and responsive rendered presence check");
|
||||
}
|
||||
}
|
||||
let mut region_reasons = Map::new();
|
||||
let overall = report.get("overall").and_then(Value::as_f64).unwrap_or(0.0);
|
||||
let mut reasons = Vec::new();
|
||||
if overall < min {
|
||||
@@ -1551,10 +1835,11 @@ fn gate_responsive(io: &Io, state: &Value, min: f64, out_dir: &str) -> Gate {
|
||||
));
|
||||
}
|
||||
for r in &missing {
|
||||
reasons.push(format!("at desktop width, region {} is missing", r.get("id").and_then(Value::as_str).unwrap_or("")));
|
||||
let id = r.get("id").and_then(Value::as_str).unwrap_or("");
|
||||
push_region_blocker(&mut reasons, &mut region_reasons, id, format!("at desktop width, region {id} is missing"));
|
||||
}
|
||||
for r in &contradicted_direction {
|
||||
reasons.push(format!(
|
||||
push_region_blocker(&mut reasons, &mut region_reasons, r.get("id").and_then(Value::as_str).unwrap_or(""), format!(
|
||||
"at desktop width, region {} ({}) is contradicted (structure {}%)",
|
||||
r.get("id").and_then(Value::as_str).unwrap_or(""),
|
||||
r.get("kind").and_then(Value::as_str).unwrap_or(""),
|
||||
@@ -1565,14 +1850,16 @@ fn gate_responsive(io: &Io, state: &Value, min: f64, out_dir: &str) -> Gate {
|
||||
g.summary = Some(format!("desktop {}% ({})", pct0(overall), report.get("verdict").and_then(Value::as_str).unwrap_or("")));
|
||||
g.score = Some(overall);
|
||||
g.side_by_side = report.pointer("/files/sideBySide").and_then(Value::as_str).map(String::from);
|
||||
g.region_reasons = region_reasons;
|
||||
publish_gate_evidence(io, out_dir, &mut report, &mut measured, ®ions, &mut g, "responsive");
|
||||
g
|
||||
}
|
||||
|
||||
fn hero_diff_labeled(io: &Io, comp_path: &str, build_path: &str, spec: Option<&Value>, out_dir: &str, label: &str) -> Result<Value, String> {
|
||||
fn hero_diff_labeled(io: &Io, comp_path: &str, build_path: &str, spec: Option<&Value>, out_dir: &str, label: &str) -> Result<(Value, CompareResult), String> {
|
||||
let comp = load_raster(io, comp_path)?;
|
||||
let build = load_raster(io, build_path)?;
|
||||
let res = compare(&comp, &build, spec, "top", label, None);
|
||||
let files = write_artifacts(&res, &comp, &abs(io, out_dir));
|
||||
let files = write_artifacts(&res, &comp, &abs(io, out_dir)).map_err(|e| format!("cannot persist comparison artifacts: {e}"))?;
|
||||
let meta = json!({
|
||||
"label": label, "comp": comp_path, "build": build_path,
|
||||
"spec": if spec.is_some() { Value::String(SPEC_PATH.into()) } else { Value::Null },
|
||||
@@ -1580,8 +1867,7 @@ fn hero_diff_labeled(io: &Io, comp_path: &str, build_path: &str, spec: Option<&V
|
||||
"buildSize": format!("{}x{}", build.width, build.height),
|
||||
});
|
||||
let report = build_report(&res, Some(&files), &meta);
|
||||
let _ = std::fs::write(abs(io, &format!("{out_dir}/report.json")), util::json_pretty(&report));
|
||||
Ok(report)
|
||||
Ok((report, res))
|
||||
}
|
||||
|
||||
// ---- transitions -----------------------------------------------------------
|
||||
@@ -1614,25 +1900,14 @@ fn force_allowed(reason: Option<&str>) -> bool {
|
||||
if reason.trim().chars().count() < 20 {
|
||||
return false;
|
||||
}
|
||||
static ERRORED: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)gate \w+ errored").unwrap());
|
||||
if ERRORED.is_match(reason) {
|
||||
return true;
|
||||
}
|
||||
static NAMES_USER: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)\buser\b|\bthey (said|asked|told|chose|picked)\b|\bpaul\b").unwrap());
|
||||
static ABOUT_COMP: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)\b(comp|mock|mockup|composition|fidelity|plate|region)\b").unwrap());
|
||||
static TRANS1: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)truthful|semantic|pixel-level|prioriti[sz]e (facts|semantics|accessibility)").unwrap());
|
||||
static TRANS2: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)(drop|skip|remove|without|not needed|don't need|do not need|ignore) (the )?(comp|plate|region|fidelity)").unwrap());
|
||||
static DOWNGRADES: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)\b(don't|do not|doesn't|does not|no longer|not) (need|have to|want|care|require|match|follow|hold)|\b(drop|skip|remove|ignore|waive|relax|override|approve|approved|accept|accepted|fine|okay|ok|good enough|ship it|move on|proceed|go ahead|instead of|rather than)\b").unwrap());
|
||||
static REPORTED: Lazy<Regex> = Lazy::new(|| Regex::new(r#"(?i)["'\u{201c}\u{2018}].{6,}["'\u{201d}\u{2019}]|\b(user|they|paul) (said|says|asked|asks|told|wrote|replied|answered|chose|picked|approved|confirmed)\b"#).unwrap());
|
||||
static BRIEF1: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)\b(should feel|feel like|not a .* page|extension of)\b").unwrap());
|
||||
static BRIEF2: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)\b(comp|mock|fidelity|gate|plate)\b.*\b(approved|accept|fine|ok|okay|skip|drop|waive|relax|override|move on|proceed)\b").unwrap());
|
||||
let names_user = NAMES_USER.is_match(reason);
|
||||
let about_comp = ABOUT_COMP.is_match(reason);
|
||||
let is_translation_dodge = TRANS1.is_match(reason) && !TRANS2.is_match(reason);
|
||||
let downgrades = DOWNGRADES.is_match(reason);
|
||||
let reported = REPORTED.is_match(reason);
|
||||
let brief_quote_only = BRIEF1.is_match(reason) && !BRIEF2.is_match(reason);
|
||||
names_user && about_comp && downgrades && reported && !is_translation_dodge && !brief_quote_only
|
||||
// Match a direct attribution together with its quotation. A user mention
|
||||
// elsewhere in the reason cannot authorize a different speaker's words.
|
||||
static QUOTE: Lazy<Regex> = Lazy::new(|| Regex::new(r#"(?i)(?:^|[.!?]\s+)(?:the\s+)?(?:user|paul)(?:\s+(?:said|says|wrote|replied|answered|confirmed|asked)\s*[:,]?|\s*:)\s*(?:"([^"]+)"|“([^”]+)”|'([^']+)'|‘([^’]+)’)"#).unwrap());
|
||||
static DOWNGRADE: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)^\s*(please\s+)?(ignore|waive|relax|skip|drop|disregard) (the )?(approved )?(comp|mockup|fidelity|plate|region)\b|^\s*(the )?(comp|mockup|fidelity|plate|region)\b[^.!?;\n]{0,40}\b(is optional|is not required|does not need to match|doesn't need to match|need not match|can differ|can be skipped)\b").unwrap());
|
||||
QUOTE.captures_iter(reason.trim()).any(|capture| {
|
||||
(1..=4).filter_map(|i| capture.get(i)).any(|q| DOWNGRADE.is_match(q.as_str()))
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
struct AdvanceResult {
|
||||
@@ -1676,16 +1951,7 @@ fn advance(io: &Io, state: &mut Value, force: bool, reason: Option<&str>, opts:
|
||||
if let Some(p) = state.pointer_mut(&format!("/phases/{phase}")).and_then(|p| p.as_object_mut()) {
|
||||
p.insert("gate".into(), gate.record_json(&now()));
|
||||
}
|
||||
if phase == "plates" {
|
||||
if let Some(plates) = &gate.plates {
|
||||
let mut m = Map::new();
|
||||
for pl in plates {
|
||||
let id = pl.get("id").and_then(Value::as_str).unwrap_or("").to_string();
|
||||
m.insert(id, json!({ "status": pl.get("status").cloned().unwrap_or(Value::Null), "score": pl.get("score").cloned().unwrap_or(Value::Null), "size": pl.get("size").cloned().unwrap_or(Value::Null) }));
|
||||
}
|
||||
state.as_object_mut().unwrap().insert("plates".into(), Value::Object(m));
|
||||
}
|
||||
}
|
||||
if phase == "plates" { save_plate_receipts(state, &gate); }
|
||||
if !gate.ok && force && !force_allowed(reason) {
|
||||
if let Some(p) = state.pointer_mut(&format!("/phases/{phase}")).and_then(|p| p.as_object_mut()) {
|
||||
p.insert("status".into(), json!("open"));
|
||||
@@ -1818,7 +2084,8 @@ mod transparency_guidance_tests {
|
||||
fn missing_plate_guidance_uses_the_configured_launcher() {
|
||||
let dir = std::env::temp_dir().join(format!("impeccable-plate-launcher-{}", std::process::id()));
|
||||
std::fs::create_dir_all(dir.join(BUILD_DIR)).unwrap();
|
||||
std::fs::write(dir.join(SPEC_PATH), json!({"regions": [{"id": "art", "medium": "raster", "plate": "missing.png"}]}).to_string()).unwrap();
|
||||
std::fs::write(dir.join(SPEC_PATH), json!({"comp":"comp.png","regions": [{"id": "art", "medium": "raster", "plate": "missing.png"}]}).to_string()).unwrap();
|
||||
std::fs::write(dir.join("comp.png"), png_io::encode_png(&r::create_image(8,8,[255,255,255,255]), &[]).unwrap()).unwrap();
|
||||
let env = [("IMPECCABLE_SELF".into(), "/custom/impeccable".into())].into();
|
||||
let (io, _) = Io::captured("", dir.clone(), env);
|
||||
let reasons = gate_plates(&io).reasons.join("\n");
|
||||
@@ -2154,3 +2421,7 @@ pub fn run(argv: &[String], io: &mut Io, organic_scan: OrganicScan) -> i32 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "build_phase/integrity_tests.rs"]
|
||||
mod integrity_tests;
|
||||
|
||||
@@ -0,0 +1,521 @@
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn delegation_is_not_authority_to_override_comp() {
|
||||
for reason in [
|
||||
"The user said 'Use your judgment to fill in missing product details from my original request.' Proceeding past the comp fidelity gate.",
|
||||
"The user answered 'Please proceed with the implementation.' I accept the comp differences.",
|
||||
"The user said \"Do not ignore the comp fidelity requirement.\"",
|
||||
"gate hero errored after the screenshot tool failed repeatedly",
|
||||
"The user says the page should feel like a bookshop, so relax the comp gate",
|
||||
] {
|
||||
assert!(!force_allowed(Some(reason)), "{reason}");
|
||||
}
|
||||
assert!(force_allowed(Some(
|
||||
"The user said \"Ignore the comp fidelity requirement; ship this version.\""
|
||||
)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stall_feedback_does_not_rebuild_a_nonblocking_plate() {
|
||||
let (io, _) = Io::captured("", std::env::temp_dir(), Default::default());
|
||||
let mut state = json!({"phases":{"hero":{"history":[]}}});
|
||||
let mut gate = Gate::fail(vec![
|
||||
"control meaning-card drifts to 60%: match the comp".into()
|
||||
]);
|
||||
gate.score = Some(0.7524);
|
||||
gate.worst_ids = vec!["accepted-fox".into()];
|
||||
for _ in 0..3 {
|
||||
if let Some(message) = hero_loop_verdict(&mut state, &gate, "missing.html", &io) {
|
||||
assert!(!message.contains("accepted-fox"), "{message}");
|
||||
assert!(!message.contains("generate-image"), "{message}");
|
||||
}
|
||||
assert!(!gate.ok);
|
||||
assert_eq!(gate.reasons.len(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
struct Workspace {
|
||||
path: PathBuf,
|
||||
}
|
||||
impl Workspace {
|
||||
fn new() -> Self {
|
||||
static NEXT: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
|
||||
let path = std::env::temp_dir().join(format!(
|
||||
"comp-integrity-{}-{}",
|
||||
std::process::id(),
|
||||
NEXT.fetch_add(1, std::sync::atomic::Ordering::Relaxed)
|
||||
));
|
||||
std::fs::create_dir_all(&path).unwrap();
|
||||
Self { path }
|
||||
}
|
||||
fn io(&self) -> Io {
|
||||
Io::captured("", self.path.clone(), Default::default()).0
|
||||
}
|
||||
fn write(&self, file: &str, bytes: &[u8]) {
|
||||
let p = self.path.join(file);
|
||||
std::fs::create_dir_all(p.parent().unwrap()).unwrap();
|
||||
std::fs::write(p, bytes).unwrap();
|
||||
}
|
||||
}
|
||||
impl Drop for Workspace {
|
||||
fn drop(&mut self) {
|
||||
let _ = std::fs::remove_dir_all(&self.path);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plate_approval_is_bound_to_current_asset_region_and_comp() {
|
||||
let ws = Workspace::new();
|
||||
ws.write("art.png", b"accepted asset bytes");
|
||||
ws.write("comp.png", b"approved comp bytes");
|
||||
let io = ws.io();
|
||||
let region =
|
||||
json!({"id":"art", "kind":"plate", "plate":"art.png", "box":{"x":0,"y":0,"w":1,"h":1}});
|
||||
let spec = json!({"comp":"comp.png", "regions":[region.clone()]});
|
||||
let receipt = json!({"id":"art", "status":"ok", "score":0.81, "file":"art.png",
|
||||
"assetHash":sha256_file(&io,"art.png"), "compHash":sha256_file(&io,"comp.png"),
|
||||
"regionHash":sha256_bytes(util::json_pretty(®ion).as_bytes())});
|
||||
let mut state = json!({"plates":{"art":receipt}});
|
||||
assert!(plate_receipt_current(&io, &state, &spec, ®ion));
|
||||
ws.write("art.png", b"replacement");
|
||||
assert!(!plate_receipt_current(&io, &state, &spec, ®ion));
|
||||
ws.write("art.png", b"accepted asset bytes");
|
||||
let mut smaller = region.clone();
|
||||
smaller["box"]["w"] = json!(0.1);
|
||||
assert!(!plate_receipt_current(&io, &state, &spec, &smaller));
|
||||
ws.write("comp.png", b"different comp");
|
||||
assert!(!plate_receipt_current(&io, &state, &spec, ®ion));
|
||||
ws.write("comp.png", b"approved comp bytes");
|
||||
state["plates"]["art"]["status"] = json!("invalid");
|
||||
assert!(!plate_receipt_current(&io, &state, &spec, ®ion));
|
||||
state["plates"]["art"] = json!({"status":"ok", "score":1.0});
|
||||
assert!(
|
||||
!plate_receipt_current(&io, &state, &spec, ®ion),
|
||||
"legacy scores must be revalidated"
|
||||
);
|
||||
std::fs::remove_file(ws.path.join("art.png")).unwrap();
|
||||
assert!(!plate_receipt_current(&io, &state, &spec, ®ion));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn copied_comp_does_not_earn_an_ok_plate_receipt_or_advance() {
|
||||
let ws = Workspace::new();
|
||||
let mut comp = r::create_image(64, 64, [230, 220, 200, 255]);
|
||||
for y in 12..52 {
|
||||
for x in 12..52 {
|
||||
let p = (y * 64 + x) * 4;
|
||||
comp.data[p..p + 4].copy_from_slice(&[90, 40, 20, 255]);
|
||||
}
|
||||
}
|
||||
ws.write("comp.png", &png_io::encode_png(&comp, &[]).unwrap());
|
||||
ws.write(
|
||||
"art.png",
|
||||
&png_io::encode_png(&r::resize(&comp, 128.0, 128.0), &[]).unwrap(),
|
||||
);
|
||||
let spec = json!({"comp":"comp.png", "regions":[{"id":"art","kind":"plate","medium":"raster","plate":"art.png",
|
||||
"box":{"x":0,"y":0,"w":1,"h":1},"px":{"x":0,"y":0,"w":64,"h":64},"detail":{"energy":20}}]});
|
||||
ws.write(SPEC_PATH, util::json_pretty(&spec).as_bytes());
|
||||
let io = ws.io();
|
||||
let gate = gate_plates(&io);
|
||||
assert!(!gate.ok);
|
||||
assert!(
|
||||
gate.reasons.iter().any(|r| r.contains("comp crop")),
|
||||
"{:?}",
|
||||
gate.reasons
|
||||
);
|
||||
assert_eq!(gate.plates.as_ref().unwrap()[0]["status"], "invalid");
|
||||
let mut state =
|
||||
json!({"phase":"plates","comp":"comp.png","phases":{"plates":{"attempts":0},"hero":{}}});
|
||||
let opts = GateOpts {
|
||||
build_path: None,
|
||||
min: None,
|
||||
artifact: None,
|
||||
};
|
||||
for _ in 0..5 {
|
||||
let result = advance(&io, &mut state, false, None, &opts, &no_organic_scan);
|
||||
assert!(!result.ok);
|
||||
assert_eq!(state["phase"], "plates");
|
||||
assert_eq!(state["plates"]["art"]["status"], "invalid");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gate_report_keeps_raw_measurements_and_does_not_turn_drift_into_a_pass() {
|
||||
let comp = r::create_image(64, 64, [230, 220, 200, 255]);
|
||||
let spec = json!({"regions":[{"id":"fox", "kind":"plate", "x":0,"y":0,"w":1,"h":1}]});
|
||||
let mut measured = compare(&comp, &comp, Some(&spec), "top", "hero", None);
|
||||
measured.regions[0].verdict = "missing".into();
|
||||
let mut report = build_report(&measured, None, &json!({}));
|
||||
let original = report.clone();
|
||||
let mut regions = report["regions"].as_array().unwrap().clone();
|
||||
regions[0]["verdict"] = json!("drift");
|
||||
regions[0]["placed"] = json!(true);
|
||||
let gate = Gate::fail(vec!["control meaning-card drifts to 60%".into()]);
|
||||
apply_gate_evidence(&mut report, &mut measured, ®ions, &gate);
|
||||
assert_eq!(report["regions"][0]["rawVerdict"], "missing");
|
||||
assert_eq!(report["regions"][0]["verdict"], "drift");
|
||||
assert_eq!(
|
||||
measured.regions[0].verdict, "drift",
|
||||
"the image writer uses the same effective verdict"
|
||||
);
|
||||
assert_eq!(
|
||||
report["regions"][0]["score"],
|
||||
original["regions"][0]["score"]
|
||||
);
|
||||
assert_eq!(report["gate"]["ok"], false);
|
||||
assert_eq!(
|
||||
report["gate"]["reasons"][0],
|
||||
"control meaning-card drifts to 60%"
|
||||
);
|
||||
assert_eq!(original["regions"][0]["verdict"], "missing");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn accepted_file_hidden_in_render_still_blocks_hero() {
|
||||
let ws = Workspace::new();
|
||||
let mut comp = r::create_image(64, 64, [230, 220, 200, 255]);
|
||||
for y in 8..56 {
|
||||
for x in 8..56 {
|
||||
let p = (y * 64 + x) * 4;
|
||||
comp.data[p..p + 4].copy_from_slice(&[40, 40, 40, 255]);
|
||||
}
|
||||
}
|
||||
ws.write("comp.png", &png_io::encode_png(&comp, &[]).unwrap());
|
||||
ws.write("art.png", &png_io::encode_png(&comp, &[]).unwrap());
|
||||
ws.write(
|
||||
"blank.png",
|
||||
&png_io::encode_png(&r::create_image(64, 64, [230, 220, 200, 255]), &[]).unwrap(),
|
||||
);
|
||||
ws.write(
|
||||
"index.html",
|
||||
b"<img src=\"art.png\" style=\"display:none\">",
|
||||
);
|
||||
let region = json!({"id":"art","kind":"plate","medium":"raster","plate":"art.png", "box":{"x":0,"y":0,"w":1,"h":1},"px":{"x":0,"y":0,"w":64,"h":64}});
|
||||
let spec = json!({"comp":"comp.png","regions":[region.clone()]});
|
||||
ws.write(SPEC_PATH, util::json_pretty(&spec).as_bytes());
|
||||
let io = ws.io();
|
||||
// Model an already accepted current asset; rendered presence is still required.
|
||||
let receipt = json!({"status":"ok","score":0.9,"file":"art.png","assetHash":sha256_file(&io,"art.png"),"compHash":sha256_file(&io,"comp.png"),"regionHash":sha256_bytes(util::json_pretty(®ion).as_bytes())});
|
||||
let mut state =
|
||||
json!({"comp":"comp.png","plates":{"art":receipt},"phases":{"hero":{"attempts":0}}});
|
||||
for _ in 0..4 {
|
||||
let g = gate_hero(
|
||||
&io,
|
||||
&mut state,
|
||||
"blank.png",
|
||||
HERO_MIN,
|
||||
"diff",
|
||||
Some("index.html"),
|
||||
&no_organic_scan,
|
||||
);
|
||||
assert!(!g.ok);
|
||||
assert!(
|
||||
g.reasons.iter().any(|r| r.contains("missing")),
|
||||
"{:?}",
|
||||
g.reasons
|
||||
);
|
||||
let report: Value =
|
||||
serde_json::from_slice(&std::fs::read(ws.path.join("diff/report.json")).unwrap())
|
||||
.unwrap();
|
||||
assert_eq!(report["gate"]["ok"], false);
|
||||
assert_eq!(report["regions"][0]["blocking"], true);
|
||||
assert_eq!(report["regions"][0]["verdict"], "missing");
|
||||
assert!(ws.path.join("diff/raw-report.json").exists());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shrinking_or_retyping_regions_does_not_disable_spec_checks() {
|
||||
let bytes = std::fs::read(
|
||||
Path::new(env!("CARGO_MANIFEST_DIR")).join("../comp/tests/fixtures/comp.png"),
|
||||
)
|
||||
.unwrap();
|
||||
let comp = png_io::decode_png(&bytes).unwrap().image;
|
||||
let tiny = json!({"regions":[{"id":"only","kind":"chrome","note":"a small control", "box":{"x":0,"y":0,"w":0.02,"h":0.02}}]});
|
||||
assert!(crate::comp_spec::measure_regions(&comp, &tiny, "comp.png").is_err());
|
||||
let retyped = json!({"regions":[{"id":"art","kind":"chrome","note":"a painted illustration", "box":{"x":0,"y":0,"w":0.1,"h":0.1}}]});
|
||||
assert!(
|
||||
crate::comp_spec::measure_regions(&comp, &retyped, "comp.png")
|
||||
.unwrap_err()
|
||||
.contains("painted material")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn preflight_failure_replaces_stale_success_report() {
|
||||
let ws = Workspace::new();
|
||||
ws.write(
|
||||
"diff/report.json",
|
||||
br#"{"gate":{"ok":true},"regions":[{"id":"old"}]}"#,
|
||||
);
|
||||
let mut state = json!({"comp":"missing.png"});
|
||||
let gate = gate_hero(
|
||||
&ws.io(),
|
||||
&mut state,
|
||||
"missing-build.png",
|
||||
HERO_MIN,
|
||||
"diff",
|
||||
None,
|
||||
&no_organic_scan,
|
||||
);
|
||||
assert!(!gate.ok);
|
||||
let report: Value =
|
||||
serde_json::from_slice(&std::fs::read(ws.path.join("diff/report.json")).unwrap()).unwrap();
|
||||
assert_eq!(report["gate"]["ok"], false);
|
||||
assert_eq!(report["measurementsAvailable"], false);
|
||||
assert_eq!(report["regions"], json!([]));
|
||||
assert_eq!(report["gate"]["reasons"], json!(gate.reasons));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unrelated_user_mention_cannot_authorize_another_speakers_quote() {
|
||||
for reason in [
|
||||
"The user requested dark mode. The designer said \"ignore the comp fidelity requirement.\"",
|
||||
"The user asked to proceed. I will \"ignore the comp fidelity requirement\"",
|
||||
"The designer said the user said \"ignore the comp fidelity requirement\"",
|
||||
"The user said \"Keep the comp.\" The designer said \"Ignore the comp.\"",
|
||||
] {
|
||||
assert!(!force_allowed(Some(reason)), "{reason}");
|
||||
}
|
||||
for reason in [
|
||||
"The user said \"Ignore the comp fidelity requirement.\"",
|
||||
"User: ‘Please waive the comp requirement.’",
|
||||
"Paul wrote: “The comp is optional.”",
|
||||
] {
|
||||
assert!(force_allowed(Some(reason)), "{reason}");
|
||||
}
|
||||
}
|
||||
|
||||
fn simple_hero_workspace() -> (Workspace, Value) {
|
||||
let ws = Workspace::new();
|
||||
let comp = r::create_image(100, 100, [150, 70, 30, 255]);
|
||||
ws.write("comp.png", &png_io::encode_png(&comp, &[]).unwrap());
|
||||
ws.write("index.html", b"<main><button>Continue</button></main>");
|
||||
ws.write(
|
||||
SPEC_PATH,
|
||||
util::json_pretty(&json!({"comp":"comp.png","regions":[{
|
||||
"id":"button","kind":"control","medium":"code","box":{"x":0,"y":0,"w":1,"h":1},
|
||||
"px":{"x":0,"y":0,"w":100,"h":100}}]}))
|
||||
.as_bytes(),
|
||||
);
|
||||
(ws, json!({"comp":"comp.png","phases":{"hero":{}}}))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failed_evidence_writes_cannot_publish_success() {
|
||||
for blocked_file in ["regions/button.png", "raw-report.json"] {
|
||||
let (ws, mut state) = simple_hero_workspace();
|
||||
let g = gate_hero(
|
||||
&ws.io(),
|
||||
&mut state,
|
||||
"comp.png",
|
||||
HERO_MIN,
|
||||
"diff",
|
||||
Some("index.html"),
|
||||
&no_organic_scan,
|
||||
);
|
||||
assert!(g.ok, "fixture: {:?}", g.reasons);
|
||||
let blocked = ws.path.join("diff").join(blocked_file);
|
||||
std::fs::remove_file(&blocked).unwrap();
|
||||
std::fs::create_dir(&blocked).unwrap();
|
||||
let g = gate_hero(
|
||||
&ws.io(),
|
||||
&mut state,
|
||||
"comp.png",
|
||||
HERO_MIN,
|
||||
"diff",
|
||||
Some("index.html"),
|
||||
&no_organic_scan,
|
||||
);
|
||||
assert!(!g.ok, "write failure must block: {blocked_file}");
|
||||
assert_no_current_measurements(&ws);
|
||||
let report: Value =
|
||||
serde_json::from_slice(&std::fs::read(ws.path.join("diff/report.json")).unwrap())
|
||||
.unwrap();
|
||||
assert_eq!(report["gate"]["ok"], false);
|
||||
assert_eq!(report["measurementsAvailable"], false);
|
||||
assert!(report["gate"]["reasons"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.any(|r| r.as_str().unwrap().contains("persist")));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_comp_cannot_approve_plates() {
|
||||
let ws = Workspace::new();
|
||||
let art = r::create_image(100, 100, [140, 60, 20, 255]);
|
||||
ws.write("art.png", &png_io::encode_png(&art, &[]).unwrap());
|
||||
ws.write(SPEC_PATH, util::json_pretty(&json!({"comp":"missing.png","regions":[{
|
||||
"id":"art","kind":"plate","medium":"raster","plate":"art.png","px":{"x":0,"y":0,"w":10,"h":10}}]})).as_bytes());
|
||||
let g = gate_plates(&ws.io());
|
||||
assert!(!g.ok);
|
||||
assert!(g.reasons.iter().any(|r| r.contains("comp")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn responsive_revalidates_legacy_or_changed_plate_receipts() {
|
||||
let (ws, mut state) = simple_hero_workspace();
|
||||
let bytes = std::fs::read(ws.path.join("comp.png")).unwrap();
|
||||
ws.write(".impeccable/review/desktop.png", &bytes);
|
||||
ws.write(".impeccable/review/mobile.png", &bytes);
|
||||
let region = json!({"id":"art","kind":"plate","medium":"raster","plate":"removed.png",
|
||||
"box":{"x":0,"y":0,"w":1,"h":1},"px":{"x":0,"y":0,"w":100,"h":100}});
|
||||
ws.write(
|
||||
SPEC_PATH,
|
||||
util::json_pretty(&json!({"comp":"comp.png","regions":[region]})).as_bytes(),
|
||||
);
|
||||
state["plates"] = json!({"art":{"status":"ok","score":0.9}});
|
||||
let g = gate_responsive(&ws.io(), &mut state, RESPONSIVE_MIN, "diff");
|
||||
assert!(!g.ok, "a missing asset cannot inherit legacy approval");
|
||||
assert!(
|
||||
g.reasons.iter().any(|r| r.contains("plate missing")),
|
||||
"{:?}",
|
||||
g.reasons
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn repair_crops_follow_blockers_not_the_lowest_raw_score() {
|
||||
let regions = vec![
|
||||
json!({"id":"advisory-art","score":{"overall":0.3}}),
|
||||
json!({"id":"blocking-control","score":{"overall":0.6}}),
|
||||
];
|
||||
let mut blockers = Map::new();
|
||||
record_region_reason(&mut blockers, "blocking-control", "control still differs");
|
||||
let repairs = repair_regions(®ions, &blockers);
|
||||
assert_eq!(repairs.len(), 1);
|
||||
assert_eq!(repairs[0]["id"], "blocking-control");
|
||||
assert!(
|
||||
repair_regions(®ions, &Map::new()).is_empty(),
|
||||
"global blockers do not justify guessing which asset to regenerate"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn folded_readings_keep_all_region_ids_without_becoming_unscoped() {
|
||||
let mut reasons = vec![];
|
||||
let mut bindings = Map::new();
|
||||
let message = "text title-1: cap height differs (also title-2)";
|
||||
let ids = [(
|
||||
message.to_string(),
|
||||
vec!["title-1".into(), "title-2".into()],
|
||||
)]
|
||||
.into();
|
||||
push_reading_blocker(&mut reasons, &mut bindings, &ids, message);
|
||||
assert_eq!(reasons, vec![message]);
|
||||
for id in ["title-1", "title-2"] {
|
||||
assert_eq!(bindings[id], json!([message]));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn responsive_failures_replace_previous_success_evidence() {
|
||||
for failure in ["missing-comp", "crop-write"] {
|
||||
let (ws, mut state) = simple_hero_workspace();
|
||||
let image = std::fs::read(ws.path.join("comp.png")).unwrap();
|
||||
ws.write(".impeccable/review/desktop.png", &image);
|
||||
ws.write(".impeccable/review/mobile.png", &image);
|
||||
let good = gate_responsive(&ws.io(), &mut state, RESPONSIVE_MIN, "diff");
|
||||
assert!(good.ok, "{:?}", good.reasons);
|
||||
let report: Value =
|
||||
serde_json::from_slice(&std::fs::read(ws.path.join("diff/report.json")).unwrap())
|
||||
.unwrap();
|
||||
assert_eq!(report["gate"]["ok"], true);
|
||||
assert_eq!(report["interpretation"], "responsive-gate");
|
||||
assert_eq!(report["regions"][0]["blocking"], false);
|
||||
if failure == "missing-comp" {
|
||||
std::fs::remove_file(ws.path.join("comp.png")).unwrap();
|
||||
} else {
|
||||
std::fs::remove_file(ws.path.join("diff/regions/button.png")).unwrap();
|
||||
std::fs::create_dir(ws.path.join("diff/regions/button.png")).unwrap();
|
||||
}
|
||||
let bad = gate_responsive(&ws.io(), &mut state, RESPONSIVE_MIN, "diff");
|
||||
assert!(!bad.ok);
|
||||
assert_no_current_measurements(&ws);
|
||||
let report: Value =
|
||||
serde_json::from_slice(&std::fs::read(ws.path.join("diff/report.json")).unwrap())
|
||||
.unwrap();
|
||||
assert_eq!(report["gate"]["ok"], false, "{failure}");
|
||||
assert_eq!(report["measurementsAvailable"], false);
|
||||
assert_eq!(report["interpretation"], "responsive-gate");
|
||||
assert_eq!(report["gate"]["reasons"], json!(bad.reasons));
|
||||
}
|
||||
}
|
||||
|
||||
fn assert_no_current_measurements(ws: &Workspace) {
|
||||
for file in ["raw-report.json", "side-by-side.png", "heatmap.png", "regions/button.png", "regions/retired.png", "regions/nested/retired.png"] {
|
||||
assert!(!ws.path.join("diff").join(file).is_file(), "stale evidence: {file}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failed_preflight_clears_complete_evidence_for_both_gates() {
|
||||
for responsive in [false, true] {
|
||||
let (ws, mut state) = simple_hero_workspace();
|
||||
let image = std::fs::read(ws.path.join("comp.png")).unwrap();
|
||||
ws.write(".impeccable/review/desktop.png", &image);
|
||||
ws.write(".impeccable/review/mobile.png", &image);
|
||||
let run = |state: &mut Value| if responsive {
|
||||
gate_responsive(&ws.io(), state, RESPONSIVE_MIN, "diff")
|
||||
} else {
|
||||
gate_hero(&ws.io(), state, "comp.png", HERO_MIN, "diff", Some("index.html"), &no_organic_scan)
|
||||
};
|
||||
assert!(run(&mut state).ok);
|
||||
ws.write("diff/regions/retired.png", &image);
|
||||
ws.write("diff/regions/nested/retired.png", &image);
|
||||
ws.write("diff/notes.txt", b"keep unrelated files");
|
||||
std::fs::remove_file(ws.path.join("comp.png")).unwrap();
|
||||
assert!(!run(&mut state).ok);
|
||||
assert_no_current_measurements(&ws);
|
||||
assert_eq!(std::fs::read(ws.path.join("diff/notes.txt")).unwrap(), b"keep unrelated files");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn successful_repeat_removes_retired_region_crops() {
|
||||
let (ws, mut state) = simple_hero_workspace();
|
||||
ws.write("diff/regions/retired.png", b"old crop");
|
||||
let gate = gate_hero(&ws.io(), &mut state, "comp.png", HERO_MIN, "diff", Some("index.html"), &no_organic_scan);
|
||||
assert!(gate.ok, "{:?}", gate.reasons);
|
||||
assert!(!ws.path.join("diff/regions/retired.png").exists());
|
||||
assert!(ws.path.join("diff/regions/button.png").is_file());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn artifact_cleanup_does_not_follow_region_directory_symlinks() {
|
||||
let (ws, mut state) = simple_hero_workspace();
|
||||
ws.write("elsewhere/keep.png", b"unrelated image");
|
||||
std::fs::create_dir_all(ws.path.join("diff")).unwrap();
|
||||
std::os::unix::fs::symlink(ws.path.join("elsewhere"), ws.path.join("diff/regions")).unwrap();
|
||||
let gate = gate_hero(&ws.io(), &mut state, "comp.png", HERO_MIN, "diff", Some("index.html"), &no_organic_scan);
|
||||
assert!(gate.ok, "{:?}", gate.reasons);
|
||||
assert_eq!(std::fs::read(ws.path.join("elsewhere/keep.png")).unwrap(), b"unrelated image");
|
||||
assert!(!ws.path.join("elsewhere/button.png").exists());
|
||||
assert!(ws.path.join("diff/regions/button.png").is_file());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn artifact_cleanup_failure_blocks_the_gate() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let (ws, mut state) = simple_hero_workspace();
|
||||
ws.write("diff/regions/retired.png", b"stale crop");
|
||||
let dir = ws.path.join("diff/regions");
|
||||
std::fs::set_permissions(&dir, std::fs::Permissions::from_mode(0o555)).unwrap();
|
||||
let gate = gate_hero(&ws.io(), &mut state, "comp.png", HERO_MIN, "diff", Some("index.html"), &no_organic_scan);
|
||||
if dir.exists() { std::fs::set_permissions(&dir, std::fs::Permissions::from_mode(0o755)).unwrap(); }
|
||||
assert!(!gate.ok);
|
||||
assert!(gate.reasons.iter().any(|r| r.contains("cannot clear comparison artifacts")), "{:?}", gate.reasons);
|
||||
let report: Value = serde_json::from_slice(&std::fs::read(ws.path.join("diff/report.json")).unwrap()).unwrap();
|
||||
assert_eq!(report["measurementsAvailable"], false);
|
||||
assert_eq!(report["gate"]["ok"], false);
|
||||
assert_no_current_measurements(&ws);
|
||||
let quarantine = ws.path.join(report["artifactCleanup"]["quarantine"]["artifacts"]["regions"].as_str().expect("cleanup failure must identify quarantined evidence"));
|
||||
assert!(quarantine.join("retired.png").is_file());
|
||||
assert_eq!(report["artifactCleanup"]["quarantine"]["errors"], json!([]));
|
||||
std::fs::set_permissions(quarantine, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
}
|
||||
@@ -284,20 +284,13 @@ pub fn resolve_regions(comp: &Image, spec: Option<&Value>) -> Vec<RegionBox> {
|
||||
|
||||
/// JS: regionCrop(img, r).
|
||||
fn region_crop(img: &Image, rr: &RegionBox) -> Image {
|
||||
let min_px = 48f64;
|
||||
let mut x = rr.x * img.width as f64;
|
||||
let mut y = rr.y * img.height as f64;
|
||||
let mut w = rr.w * img.width as f64;
|
||||
let mut h = rr.h * img.height as f64;
|
||||
if h < min_px {
|
||||
y -= (min_px - h) / 2.0;
|
||||
h = min_px;
|
||||
}
|
||||
if w < min_px {
|
||||
x -= (min_px - w) / 2.0;
|
||||
w = min_px;
|
||||
}
|
||||
r::crop(img, x, y, w, h)
|
||||
// Sampling support must not add neighbouring elements to a declared region.
|
||||
let bounds = r::clamp_rect(img, rr.x * img.width as f64, rr.y * img.height as f64,
|
||||
rr.w * img.width as f64, rr.h * img.height as f64);
|
||||
// A subpixel box still samples an actual pixel, including at the far edge.
|
||||
r::crop(img, bounds.x.min(img.width.saturating_sub(1)) as f64,
|
||||
bounds.y.min(img.height.saturating_sub(1)) as f64,
|
||||
bounds.w.max(1) as f64, bounds.h.max(1) as f64)
|
||||
}
|
||||
|
||||
fn ink_box_json(b: &Option<InkBox>) -> Value {
|
||||
@@ -507,7 +500,7 @@ fn render_heatmap(comp: &Image, build: &Image) -> Image {
|
||||
}
|
||||
|
||||
/// JS: renderRegionPair(compCrop, buildCrop, id, score).
|
||||
fn render_region_pair(comp_crop: &Image, build_crop: &Image, id: &str, score: &Score) -> Image {
|
||||
fn render_region_pair(comp_crop: &Image, build_crop: &Image, id: &str, score: &Score, verdict: &str, gate_region: Option<&Value>) -> Image {
|
||||
let gap = 16f64;
|
||||
let pad = 12f64;
|
||||
let max_w = 700f64;
|
||||
@@ -520,11 +513,16 @@ fn render_region_pair(comp_crop: &Image, build_crop: &Image, id: &str, score: &S
|
||||
);
|
||||
r::blit(&mut out, &a, pad, pad + 30.0);
|
||||
r::blit(&mut out, &b, pad + a.width as f64 + gap, pad + 30.0);
|
||||
let v = verdict_for(score, None);
|
||||
let v = verdict;
|
||||
let gate_label = gate_region.map(|region| match region.get("blocking").and_then(Value::as_bool) {
|
||||
Some(true) => " / BLOCKING",
|
||||
Some(false) => " / NONBLOCKING",
|
||||
None => " / CHECK GATE",
|
||||
}).unwrap_or("");
|
||||
r::draw_label(&mut out, &format!("{} COMP", id.to_uppercase()), pad, pad, [255.0, 255.0, 255.0, 255.0], [0.0, 0.0, 0.0, 220.0], 2.0, 4.0);
|
||||
r::draw_label(
|
||||
&mut out,
|
||||
&format!("BUILD {} {}%", v.to_uppercase(), to_fixed(score.overall * 100.0, 0)),
|
||||
&format!("BUILD {} {}%{gate_label}", v.to_uppercase(), to_fixed(score.overall * 100.0, 0)),
|
||||
pad + a.width as f64 + gap,
|
||||
pad,
|
||||
[255.0, 255.0, 255.0, 255.0],
|
||||
@@ -544,24 +542,32 @@ fn write_png(path: &Path, img: &Image) -> Result<(), String> {
|
||||
}
|
||||
|
||||
/// JS: writeArtifacts(result, comp, outDir).
|
||||
pub fn write_artifacts(result: &CompareResult, comp: &Image, out_dir: &Path) -> Value {
|
||||
let _ = std::fs::create_dir_all(out_dir.join("regions"));
|
||||
pub fn write_artifacts(result: &CompareResult, comp: &Image, out_dir: &Path) -> Result<Value, String> {
|
||||
std::fs::create_dir_all(out_dir.join("regions")).map_err(|e| e.to_string())?;
|
||||
let side = render_side_by_side(comp, &result.aligned, &result.label, &result.whole);
|
||||
let side_path = out_dir.join("side-by-side.png");
|
||||
let _ = write_png(&side_path, &side);
|
||||
write_png(&side_path, &side)?;
|
||||
let heat_path = out_dir.join("heatmap.png");
|
||||
let _ = write_png(&heat_path, &render_heatmap(comp, &result.aligned));
|
||||
let mut region_files: Vec<Value> = Vec::new();
|
||||
for rg in &result.regions {
|
||||
let file = out_dir.join("regions").join(format!("{}.png", rg.id));
|
||||
let _ = write_png(&file, &render_region_pair(&rg.a, &rg.b, &rg.id, &rg.score));
|
||||
region_files.push(json!(path_str(&file)));
|
||||
}
|
||||
json!({
|
||||
write_png(&heat_path, &render_heatmap(comp, &result.aligned))?;
|
||||
let region_files = write_region_artifacts(result, out_dir, None)?;
|
||||
Ok(json!({
|
||||
"sideBySide": path_str(&side_path),
|
||||
"heatmap": path_str(&heat_path),
|
||||
"regionFiles": region_files,
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
/// Refresh labels after gate interpretation, without rerunning measurements.
|
||||
pub fn write_region_artifacts(result: &CompareResult, out_dir: &Path, gate_regions: Option<&[Value]>) -> Result<Vec<Value>, String> {
|
||||
let mut region_files: Vec<Value> = Vec::new();
|
||||
for rg in &result.regions {
|
||||
let file = out_dir.join("regions").join(format!("{}.png", rg.id));
|
||||
let gate_region = gate_regions.and_then(|regions| regions.iter().find(|r| r.get("id").and_then(Value::as_str) == Some(rg.id.as_str())));
|
||||
write_png(&file, &render_region_pair(&rg.a, &rg.b, &rg.id, &rg.score, &rg.verdict, gate_region))
|
||||
.map_err(|e| format!("{}: {e}", file.display()))?;
|
||||
region_files.push(json!(path_str(&file)));
|
||||
}
|
||||
Ok(region_files)
|
||||
}
|
||||
|
||||
fn path_str(p: &Path) -> String {
|
||||
@@ -739,7 +745,10 @@ pub fn run(argv: &[String], io: &mut Io) -> i32 {
|
||||
let files = if flag(argv, "no-files") {
|
||||
None
|
||||
} else {
|
||||
Some(write_artifacts(&result, &comp, &resolve(io, &out_dir)))
|
||||
match write_artifacts(&result, &comp, &resolve(io, &out_dir)) {
|
||||
Ok(files) => Some(files),
|
||||
Err(e) => { io.err(&format!("comp-diff: cannot persist comparison artifacts: {e}\n")); return 1; }
|
||||
}
|
||||
};
|
||||
let meta = json!({
|
||||
"label": label,
|
||||
@@ -752,7 +761,9 @@ pub fn run(argv: &[String], io: &mut Io) -> i32 {
|
||||
let report = build_report(&result, files.as_ref(), &meta);
|
||||
if files.is_some() {
|
||||
let rp = resolve(io, &out_dir).join("report.json");
|
||||
let _ = std::fs::write(&rp, util::json_pretty(&report));
|
||||
if let Err(e) = std::fs::write(&rp, util::json_pretty(&report)) {
|
||||
io.err(&format!("comp-diff: cannot persist report: {e}\n")); return 1;
|
||||
}
|
||||
}
|
||||
if flag(argv, "json") {
|
||||
io.out(&format!("{}\n", util::json_pretty(&report)));
|
||||
@@ -773,3 +784,36 @@ pub fn run(argv: &[String], io: &mut Io) -> i32 {
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod region_isolation_regression {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn subpixel_regions_sample_real_pixels() {
|
||||
let a = r::create_image(10, 10, [220, 10, 20, 255]);
|
||||
let b = r::create_image(10, 10, [10, 30, 210, 255]);
|
||||
for (x, y) in [(0.2, 0.2), (0.99, 0.99)] {
|
||||
let rr = RegionBox { id: "tiny".into(), x, y, w:0.001, h:0.001, kind:None };
|
||||
let ac = region_crop(&a, &rr);
|
||||
let bc = region_crop(&b, &rr);
|
||||
assert_eq!(&ac.data[..4], &[220,10,20,255]);
|
||||
assert_eq!(&bc.data[..4], &[10,30,210,255]);
|
||||
assert_ne!(ac.data, bc.data);
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn small_region_does_not_sample_neighbours() {
|
||||
let a = r::create_image(256, 128, [240, 220, 190, 255]);
|
||||
let mut b = a.clone();
|
||||
for y in 40..53 { for x in 60..180 {
|
||||
let p = (y * 256 + x) * 4;
|
||||
b.data[p..p+4].copy_from_slice(&[20,20,20,255]);
|
||||
}}
|
||||
let rr = RegionBox { id: "toolbar".into(), x:60.0/256.0, y:53.0/128.0,
|
||||
w:120.0/256.0, h:22.0/128.0, kind:Some("chrome".into()) };
|
||||
let ac = region_crop(&a, &rr);
|
||||
let bc = region_crop(&b, &rr);
|
||||
assert_eq!(ac.height, 22, "crop must honor the declared box");
|
||||
assert_eq!(ac.data, bc.data, "neighbours cannot change the target pixels");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,39 @@ static LAUNCHER_HOOK_MARKER: Lazy<Regex> = Lazy::new(|| {
|
||||
Regex::new(r#"skills/impeccable/scripts/impeccable(?:\.cmd|\.exe)?["']?\s+hook(?:-before-edit|-probe|-after-edit|-stop)?(?:\s|$|["'&|;)])"#).unwrap()
|
||||
});
|
||||
|
||||
/// User-scope Windows commands embed a JSON-quoted path whose backslashes are
|
||||
/// doubled in the command string (#784). #604's single `\`→`/` replace is not
|
||||
/// enough: `\\` becomes `//`, which breaks `skills/impeccable` matching.
|
||||
/// A leading `//` after a quote (or at the start of the string) is a UNC
|
||||
/// prefix and stays two slashes, so doctor still probes `//server/share/...`.
|
||||
fn normalize_hook_separators(command: &str) -> String {
|
||||
let mut out = String::with_capacity(command.len());
|
||||
let mut chars = command.chars().peekable();
|
||||
let mut prev: Option<char> = None;
|
||||
while let Some(ch) = chars.next() {
|
||||
if ch != '\\' && ch != '/' {
|
||||
out.push(ch);
|
||||
prev = Some(ch);
|
||||
continue;
|
||||
}
|
||||
let mut n = 1usize;
|
||||
while matches!(chars.peek(), Some('\\' | '/')) {
|
||||
chars.next();
|
||||
n += 1;
|
||||
}
|
||||
out.push('/');
|
||||
if n >= 2 && matches!(prev, None | Some('"' | '\'')) {
|
||||
out.push('/');
|
||||
}
|
||||
prev = Some('/');
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// True when `command` invokes an Impeccable hook in either generation's spelling.
|
||||
pub fn is_impeccable_hook_command(command: &str) -> bool {
|
||||
LEGACY_HOOK_SCRIPT_MARKERS.iter().any(|m| command.contains(m)) || LAUNCHER_HOOK_MARKER.is_match(command)
|
||||
let command = normalize_hook_separators(command);
|
||||
LEGACY_HOOK_SCRIPT_MARKERS.iter().any(|m| command.contains(m)) || LAUNCHER_HOOK_MARKER.is_match(&command)
|
||||
}
|
||||
|
||||
/// True when `command` invokes an Impeccable hook in the launcher generation
|
||||
@@ -40,7 +70,7 @@ pub fn is_impeccable_hook_command(command: &str) -> bool {
|
||||
/// one: install/update use this to decide which manifests still need
|
||||
/// migrating to the launcher form.
|
||||
pub fn is_launcher_hook_command(command: &str) -> bool {
|
||||
LAUNCHER_HOOK_MARKER.is_match(command)
|
||||
LAUNCHER_HOOK_MARKER.is_match(&normalize_hook_separators(command))
|
||||
}
|
||||
|
||||
/// The launcher-era markers `context` and `doctor` treat as the design hook
|
||||
@@ -54,9 +84,10 @@ static LAUNCHER_DESIGN_HOOK: Lazy<Regex> = Lazy::new(|| {
|
||||
/// `hook-before-edit`) in either spelling; the JS `context.mjs` scan and
|
||||
/// `staleness-deep` HOOK_SCRIPT_MARKERS both meant exactly these two.
|
||||
pub fn is_design_hook_command(command: &str) -> bool {
|
||||
let command = normalize_hook_separators(command);
|
||||
command.contains("skills/impeccable/scripts/hook.mjs")
|
||||
|| command.contains("skills/impeccable/scripts/hook-before-edit.mjs")
|
||||
|| LAUNCHER_DESIGN_HOOK.is_match(command)
|
||||
|| LAUNCHER_DESIGN_HOOK.is_match(&command)
|
||||
}
|
||||
|
||||
/// True when `command` runs the design hook (`hook` / `hook-before-edit`) in
|
||||
@@ -66,7 +97,7 @@ pub fn is_design_hook_command(command: &str) -> bool {
|
||||
/// so the hook is dead and `MANUAL_DETECTOR_REQUIRED` must fire until an
|
||||
/// install/update repairs it.
|
||||
pub fn is_launcher_design_hook_command(command: &str) -> bool {
|
||||
LAUNCHER_DESIGN_HOOK.is_match(command)
|
||||
LAUNCHER_DESIGN_HOOK.is_match(&normalize_hook_separators(command))
|
||||
}
|
||||
|
||||
/// The shell token that names the hook program inside `command`, for
|
||||
@@ -74,7 +105,11 @@ pub fn is_launcher_design_hook_command(command: &str) -> bool {
|
||||
/// path in the binary form. `None` when the command carries no marker or
|
||||
/// the token cannot be isolated (a `'\''` escape sequence, for instance).
|
||||
pub fn hook_program_token(command: &str) -> Option<String> {
|
||||
if !is_design_hook_command(command) {
|
||||
if command.contains("'\\''") {
|
||||
return None;
|
||||
}
|
||||
let command = normalize_hook_separators(command);
|
||||
if !is_design_hook_command(&command) {
|
||||
return None;
|
||||
}
|
||||
static QUOTED: Lazy<Regex> = Lazy::new(|| {
|
||||
@@ -86,16 +121,13 @@ pub fn hook_program_token(command: &str) -> Option<String> {
|
||||
static BARE: Lazy<Regex> = Lazy::new(|| {
|
||||
Regex::new(r#"([^\s"'|&;()]*skills/impeccable/scripts/(?:hook(?:-before-edit)?\.mjs|impeccable(?:\.cmd|\.exe)?))"#).unwrap()
|
||||
});
|
||||
if let Some(m) = QUOTED.captures(command) {
|
||||
if let Some(m) = QUOTED.captures(&command) {
|
||||
return Some(m[1].to_string());
|
||||
}
|
||||
if command.contains("'\\''") {
|
||||
return None;
|
||||
}
|
||||
if let Some(m) = SINGLE.captures(command) {
|
||||
if let Some(m) = SINGLE.captures(&command) {
|
||||
return Some(m[1].to_string());
|
||||
}
|
||||
BARE.captures(command).map(|m| m[1].to_string())
|
||||
BARE.captures(&command).map(|m| m[1].to_string())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -183,4 +215,45 @@ mod tests {
|
||||
assert_eq!(hook_program_token("'/x/it'\\''s/.claude/skills/impeccable/scripts/impeccable' hook"), None);
|
||||
assert_eq!(hook_program_token("echo hi"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recognizes_json_escaped_windows_launcher_path() {
|
||||
let launcher = r"C:\Users\alice\.claude\skills\impeccable\scripts\impeccable";
|
||||
let quoted = serde_json::to_string(launcher).unwrap();
|
||||
let cmd = format!("[ ! -f {quoted} ] || {quoted} hook");
|
||||
assert!(is_impeccable_hook_command(&cmd), "{cmd}");
|
||||
assert!(is_launcher_hook_command(&cmd), "{cmd}");
|
||||
assert!(is_design_hook_command(&cmd), "{cmd}");
|
||||
assert_eq!(
|
||||
hook_program_token(&cmd).as_deref(),
|
||||
Some("C:/Users/alice/.claude/skills/impeccable/scripts/impeccable")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recognizes_single_backslash_windows_path() {
|
||||
let cmd = r#"[ ! -f "C:\Users\alice\.claude\skills\impeccable\scripts\impeccable" ] || "C:\Users\alice\.claude\skills\impeccable\scripts\impeccable" hook"#;
|
||||
assert!(is_impeccable_hook_command(cmd), "{cmd}");
|
||||
assert!(is_launcher_hook_command(cmd), "{cmd}");
|
||||
assert!(is_design_hook_command(cmd), "{cmd}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn preserves_unc_prefix_in_program_token() {
|
||||
let launcher = r"\\server\share\.claude\skills\impeccable\scripts\impeccable";
|
||||
let quoted = serde_json::to_string(launcher).unwrap();
|
||||
let json_escaped = format!("[ ! -f {quoted} ] || {quoted} hook");
|
||||
assert!(is_impeccable_hook_command(&json_escaped), "{json_escaped}");
|
||||
assert_eq!(
|
||||
hook_program_token(&json_escaped).as_deref(),
|
||||
Some("//server/share/.claude/skills/impeccable/scripts/impeccable")
|
||||
);
|
||||
|
||||
let single = r#"[ ! -f "\\server\share\.claude\skills\impeccable\scripts\impeccable" ] || "\\server\share\.claude\skills\impeccable\scripts\impeccable" hook"#;
|
||||
assert!(is_impeccable_hook_command(single), "{single}");
|
||||
assert_eq!(
|
||||
hook_program_token(single).as_deref(),
|
||||
Some("//server/share/.claude/skills/impeccable/scripts/impeccable")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,13 +219,10 @@ fn rewrite_value(value: &Value, provider: &str, quoted: &QuotedPath, win32: bool
|
||||
}
|
||||
}
|
||||
|
||||
/// JS: valueHasImpeccableHookMarker(value). Command separators are
|
||||
/// normalized to `/` first so a legacy Windows-path guard is still
|
||||
/// recognized as ours and replaced instead of duplicated (upstream
|
||||
/// 665c51b9, #604).
|
||||
/// JS: valueHasImpeccableHookMarker(value).
|
||||
pub fn value_has_impeccable_hook_marker(value: &Value) -> bool {
|
||||
match value {
|
||||
Value::String(s) => is_impeccable_hook_command(&s.replace('\\', "/")),
|
||||
Value::String(s) => is_impeccable_hook_command(s),
|
||||
Value::Array(a) => a.iter().any(value_has_impeccable_hook_marker),
|
||||
Value::Object(o) => o.values().any(value_has_impeccable_hook_marker),
|
||||
_ => false,
|
||||
@@ -233,12 +230,9 @@ pub fn value_has_impeccable_hook_marker(value: &Value) -> bool {
|
||||
}
|
||||
|
||||
/// True when `value` names an Impeccable hook in the launcher generation.
|
||||
/// Separators are normalized to `/` first, matching
|
||||
/// `value_has_impeccable_hook_marker`, so a legacy Windows-path launcher
|
||||
/// command is still recognized.
|
||||
pub fn value_has_launcher_hook_marker(value: &Value) -> bool {
|
||||
match value {
|
||||
Value::String(s) => is_launcher_hook_command(&s.replace('\\', "/")),
|
||||
Value::String(s) => is_launcher_hook_command(s),
|
||||
Value::Array(a) => a.iter().any(value_has_launcher_hook_marker),
|
||||
Value::Object(o) => o.values().any(value_has_launcher_hook_marker),
|
||||
_ => false,
|
||||
|
||||
@@ -357,3 +357,57 @@ fn hook_artifacts_map_providers_to_manifest_files() {
|
||||
assert_eq!(c[0].dest, jsp::join(&["/p", ".codex", "hooks.json"]));
|
||||
assert!(c[0].shared_dest.is_none());
|
||||
}
|
||||
|
||||
fn windows_user_scope_hook_command() -> String {
|
||||
let launcher = r"C:\Users\alice\.claude\skills\impeccable\scripts\impeccable";
|
||||
let q = json_string(launcher);
|
||||
format!("[ ! -f {q} ] || {q} hook")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn merge_json_escaped_windows_launcher_is_idempotent() {
|
||||
let cmd = windows_user_scope_hook_command();
|
||||
let hook_entry = |cmd: String| {
|
||||
json!({ "matcher": "Edit", "hooks": [{ "type": "command", "command": cmd }] })
|
||||
};
|
||||
let stop_entry = |cmd: String| {
|
||||
json!({ "hooks": [{ "type": "command", "command": cmd, "timeout": 30 }] })
|
||||
};
|
||||
let existing = json!({
|
||||
"hooks": {
|
||||
"PostToolUse": [hook_entry(cmd.clone())],
|
||||
"Stop": [stop_entry(cmd.clone())]
|
||||
}
|
||||
});
|
||||
let fresh = json!({
|
||||
"description": "fresh",
|
||||
"hooks": {
|
||||
"PostToolUse": [hook_entry(cmd.clone())],
|
||||
"Stop": [stop_entry(cmd.clone())]
|
||||
}
|
||||
});
|
||||
let merged = merge_hook_manifests(&existing, &fresh);
|
||||
assert_eq!(merged["hooks"]["PostToolUse"].as_array().unwrap().len(), 1);
|
||||
assert_eq!(merged["hooks"]["Stop"].as_array().unwrap().len(), 1);
|
||||
let merged2 = merge_hook_manifests(&merged, &fresh);
|
||||
assert_eq!(merged2["hooks"]["PostToolUse"].as_array().unwrap().len(), 1);
|
||||
assert_eq!(merged2["hooks"]["Stop"].as_array().unwrap().len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn merge_heals_triplicated_stop_groups() {
|
||||
let cmd = windows_user_scope_hook_command();
|
||||
let stop_entry = json!({ "hooks": [{ "type": "command", "command": cmd.clone(), "timeout": 30 }] });
|
||||
let existing = json!({
|
||||
"hooks": {
|
||||
"Stop": [stop_entry.clone(), stop_entry.clone(), stop_entry]
|
||||
}
|
||||
});
|
||||
let fresh = json!({
|
||||
"hooks": {
|
||||
"Stop": [json!({ "hooks": [{ "type": "command", "command": cmd, "timeout": 30 }] })]
|
||||
}
|
||||
});
|
||||
let merged = merge_hook_manifests(&existing, &fresh);
|
||||
assert_eq!(merged["hooks"]["Stop"].as_array().unwrap().len(), 1);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "impeccable",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.1",
|
||||
"description": "Design and refine interfaces with Impeccable skills, specialist agents, and design checks.",
|
||||
"author": {
|
||||
"name": "Renaissance Geek, Inc."
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
license: Apache 2.0
|
||||
---
|
||||
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# Comp gate evidence and integrity
|
||||
|
||||
Comp fidelity still has two independent requirements: the numeric score and the
|
||||
absence of blocking findings. A high overall score, a repeated attempt, or an
|
||||
existing plate file does not satisfy a missing-region check.
|
||||
|
||||
## Measurements and decisions
|
||||
|
||||
`comp-diff` measures the declared region bounds. It does not enlarge a narrow
|
||||
region to include neighbouring elements. Subpixel regions sample at least one
|
||||
real source pixel, including at image edges. Coverage and region-kind checks remain
|
||||
the responsibility of `comp-spec`; this change does not authorize omitting
|
||||
regions or shrinking their bounds to exclude required work.
|
||||
|
||||
A standalone `comp-diff` report contains raw verdicts. The hero gate can interpret
|
||||
those measurements using current plate validation and rendered presence. For
|
||||
hero and responsive evidence:
|
||||
|
||||
- `raw-report.json` retains uninterpreted metrics and verdicts.
|
||||
- `report.json` retains the same scores, adds `rawVerdict` to each region, and
|
||||
publishes the effective `verdict` used by the gate and paired image label.
|
||||
- `gate.ok` and `gate.reasons` describe whether advancement is allowed and all
|
||||
unresolved blockers. `drift` alone does not mean a region is nonblocking.
|
||||
- Paired images label their gate status as `BLOCKING`, `NONBLOCKING`, or
|
||||
`CHECK GATE`, using the same report fields.
|
||||
- Region-specific blockers are recorded as `blockingReasons`. `blocking: null`
|
||||
means an unscoped blocking finding prevents attributing a clean bill of health
|
||||
to that region. Unscoped findings remain in `gate.unscopedReasons`; they are
|
||||
not hidden or waived.
|
||||
|
||||
When capture, spec, or plate validation fails before measurement, the current
|
||||
report has `measurementsAvailable: false`, no region results, and the failed
|
||||
gate reasons. It does not present the preceding capture as current evidence.
|
||||
|
||||
Repair crops include only regions with current blockers; shared readings retain
|
||||
all affected region IDs. Frame-wide blockers keep their whole-frame evidence.
|
||||
Both hero and responsive reports are marked incomplete before preflight and
|
||||
image writes, then committed atomically only after the evidence files succeed.
|
||||
Each attempt clears the previous raw report, whole-frame PNGs, and region PNGs;
|
||||
failed attempts also clear any partial evidence they wrote. Removed regions cannot
|
||||
leave old crops in a successful comparison. Cleanup is limited to generated files,
|
||||
does not follow region-directory symlinks, and blocks the gate if it fails.
|
||||
When removal fails, the remaining generated set is renamed beside its current paths under a unique
|
||||
`invalid-comparison-*` prefix. `artifactCleanup` and a quarantine manifest record
|
||||
the moved paths. Keeping the same parent avoids requiring write access to the
|
||||
read-only directory itself.
|
||||
If filesystem permissions also prevent quarantine, that field records the error
|
||||
and explicitly lists the invalid artifact paths; no evidence is certified and the
|
||||
gate remains closed.
|
||||
Write failures block the gate
|
||||
and, when the report location is writable, publish an unavailable-evidence report.
|
||||
|
||||
Stall feedback follows repeated blocking reasons. It never chooses an asset to
|
||||
regenerate solely because that asset has the lowest raw score. The feedback is
|
||||
additional context; it does not clear a finding or advance the phase.
|
||||
|
||||
## Plate validation
|
||||
|
||||
Successful plate receipts include SHA-256 fingerprints of the asset bytes,
|
||||
measured region, and comp. Hero and responsive gates revalidate receipts. A changed or deleted file, a changed region, or a
|
||||
changed comp invalidates the receipt. Legacy score-only receipts are revalidated.
|
||||
An invalid plate cannot receive an `ok` receipt merely because its PNG decoded.
|
||||
Rendered presence is still checked after asset validation, so a file hidden in
|
||||
the page does not count as placed.
|
||||
|
||||
## Overrides
|
||||
|
||||
A `--force --reason` must contain a direct quoted downgrade of comp authority
|
||||
immediately attributed to the user. An unrelated mention of the user does not
|
||||
authorize a quote from another speaker. Generic delegation, the builder's surrounding claim that
|
||||
it may proceed, or a gate exception does not establish that authorization.
|
||||
The quote parser is deliberately conservative. It cannot authenticate a quote:
|
||||
the calling harness must retain the actual user answer and assess provenance.
|
||||
Neither local receipts nor caller-written state are a security boundary against
|
||||
an agent with arbitrary write access to all files and engine code.
|
||||
|
||||
## Validation
|
||||
|
||||
The comp-verbs regressions cover narrow-region isolation, changed/deleted plate
|
||||
receipts, comp-crop reuse, hidden rendered assets, repeated failed attempts,
|
||||
ambiguous overrides, spec coverage and kind refusals, and raw/effective report
|
||||
agreement. They do not certify semantic equivalence of arbitrary artwork or
|
||||
justify relaxing a fidelity threshold.
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "impeccable",
|
||||
"description": "Design fluency for frontend development. 1 skill with 23 commands (/impeccable polish, /impeccable audit, /impeccable critique, etc.) and curated anti-pattern detection.",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.1",
|
||||
"author": {
|
||||
"name": "Paul Bakaus",
|
||||
"email": "paul@paulbakaus.com"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "impeccable",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.1",
|
||||
"description": "Design fluency for frontend development. 1 skill with 23 commands (/impeccable polish, /impeccable audit, /impeccable critique, etc.) and curated anti-pattern detection.",
|
||||
"author": {
|
||||
"name": "Paul Bakaus",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: impeccable
|
||||
description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks.
|
||||
version: 4.3.0
|
||||
version: 4.3.1
|
||||
user-invocable: true
|
||||
argument-hint: "[shape · audit|critique · animate|bolder|colorize|delight|layout|overdrive|quieter|typeset · adapt|clarify|distill · harden|onboard|optimize|polish · init|document|extract|live] [target]"
|
||||
license: Apache 2.0
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -109,7 +109,7 @@ The comp-led path is a frontier-tier job: it asks the builder to hold a measured
|
||||
|
||||
1. **spec.** Measure the comp: `impeccable comp-spec --comp <comp> --grid` writes a coordinate grid over the comp; open it, name every salient region by grid span in a regions file (text and control regions snap to the largest ink mass inside their span, so a headline named B1:E4 measures as the headline and not the column beside it; `snap: false` keeps the span, and an explicit `box` is taken as drawn) (kind `plate` / `image` / `texture` for anything painted: every illustration, photograph, figure, product object, and material texture; `text` / `control` / `chrome` for what code draws; every region carries a `note` saying what the comp shows there, which the plate prompt and the gate messages read), and run `impeccable comp-spec --comp <comp> --regions <file>`. The spec carries each region's box, sampled palette, and medium; `impeccable comp-spec --print` is the build's reference from here on. Type is measured, not guessed: `impeccable font-match --measure <text region>` reads the comp's cap height, width class, and weight off the pixels, and `impeccable font-match --rank <region> --text "..."` takes its candidates from a fingerprint index of the Google Fonts catalog (the nearest faces to the crop's shape) plus any names you pass with `--candidates`, renders them at that cap height with the region's words, and ranks them by fingerprint distance (its `USE` line is the CSS; its proof sheet shows the comp over the top three); with no browser resolvable it records the catalog's nearest face and says the size is estimated, which is still the choice to build on. Do not install a browser to rank, and never write a `chosen` face into the spec by hand: the gate accepts only what font-match wrote. The spec gate refuses to close until the lead text region is measured and ranked. A region note that describes painted material (a diagram, drawing, photograph, texture) under a code kind is refused at the spec: reclassify it as a plate, or reword the note if code really draws it. The script refuses a regions file that leaves comp ink unnamed (callouts, a parts table, a notes block): what is never named can never be missing, so everything the comp shows gets a region. It also refuses a `text` / `control` / `chrome` region larger than a quarter of the comp: that is a column, not an element, and a column scored as one region hides the plates, tables, and notes inside it. Name each element inside it (`container: true` only when it truly is one undivided element). Anything drawn is a plate: an inline SVG past an icon's budget (a diagram, notation, leader lines with arrows, a "quick approximation" of the artwork) is refused at the hero; icon-sized SVG (under 64px, a few paths) is fine, and a chart the page draws from data at runtime is a chart, not an illustration. Callout lines and arrows that annotate a drawing belong to that drawing's plate, with only their labels set as text. A crop of the comp is never a plate (the plates gate refuses a file that is a resample of the comp region: the comp's grain, its neighbours' edges, and its resolution would ship as the artwork); the crop is the reference the plate is generated from. A plate region's box has to hold its whole artwork with a margin: the spec measures the artwork's contact with the box edges and refuses a box that cuts through it (`bleed: true` only when the page really crops it there), because a plate placed with `object-fit: cover` on such a box shows the artwork minus the side the box lost. Anything not in the spec does not exist on the page: no borders, rules, containers, or chrome the comp does not show. Only three concessions exist: fonts (the closest obtainable face), icon glyphs (close enough, exact if the user chose an icon library; this covers the pictogram only, never a control's chrome, so a chevron, an arrow, a dropdown's border and fill, a button's shape are the comp's), and genuine defects in the comp such as spelling errors. <!-- rule:skill-comp-spec -->
|
||||
2. **plates.** Every raster region ships as a plate: an illustration, photo, or figure regenerated at asset resolution from its comp crop, UI text removed, at its `plate` path (isolated ink, figures, or objects use native transparent PNG so they sit on the page's own ground; photos and textures stay opaque); a texture (paper, cloth, grain) is a clean patch of the comp region mirror-tiled to size, generated only when no clean patch exists. `impeccable comp-spec --crop <id>` writes the reference; save `impeccable comp-spec --plate-prompt <id> --background transparent` to a prompt file for a cutout, or use `--background opaque` otherwise. Prefer the harness-native image tool with that crop and prompt, then `impeccable embed-prompt <plate> --prompt-file <prompt.txt>`. The API fallback is `impeccable generate-image --ref <crop.png> --prompt-file <prompt.txt> --out <plate.png> --size <WxH> --quality high --background transparent` (use `--background opaque` for full-frame assets); create the output directory first. Verify actual alpha, white foregrounds, fine edges, and clear holes on light and dark grounds; do not chroma-key native output. The plates gate scores the assets against the comp; also inspect placement and scale visually. With parallel subagents, spawn the shipped asset producer (`impeccable-asset-producer`; `impeccable_asset_producer` in codex; `/impeccable-asset-producer` in Cursor; on GitHub Copilot say "Use the impeccable-asset-producer agent") with the spec path and let it produce them all; without subagents, produce them here. A crop of the comp is a reference, never a shipping pixel. The gate checks every plate exists, is at least 1.5x the region's size, and reads as the region. Page code waits for this gate: a page written before its plates exist is a page that draws its material in CSS. A single-file deliverable changes nothing here: the plate is produced the same way and inlined as a data URI. `--force` exists for one case only, the user downgrading the comp's authority in words you quote in `--reason`; the script refuses every other reason. <!-- rule:skill-plates-before-page -->
|
||||
3. **hero.** `impeccable build-phase scaffold` first: it writes the measured layout as CSS custom properties (`.impeccable/build/scaffold/layout.css`: `--r-<id>-x/y/w/h` in % of the comp, plus cap height, font-size, family, and weight where measured) and a reference page (`hero-reference.html`) with every region at its box and every plate placed. Bind the numbers to your own semantic structure, an element per region; the reference is a check on positions, never the page, and overlapping boxes are overlapping boxes. Then build only the first viewport, at the comp's own dimensions, the comp's words copied verbatim (the user approved that comp with those words; rewording is a stated decision after the hero passes, never a silent one inside it), every text region sized from its measured cap height and set in its ranked face, plates first: place every plate at its spec box (`object-fit: cover`, an `<img>`, a background image, or an inlined data URI named for it) before any text or control, capture into `.impeccable/review/hero-repro.png`, run `impeccable build-phase record hero` once so you see the plate regions read as match before any text exists, then lay the semantic layer over the plates from the spec's palette and boxes and advance. The gate first refuses while any plate is unreferenced by the source, then runs `impeccable comp-diff`, writes `.impeccable/review/diff/hero/` (side-by-side, heatmap, one paired crop per region, `report.json`), and passes at 72% overall with no hard veto outstanding (a missing region, a contradicted plate or text block, an SVG illustration, a clipped plate, invented ink block at any score); above the bar, the numeric readings become advisories printed with the pass, and the polish pass before responsive is where they get fixed: the gate also reads each text region's cap height, line count, weight, ink colour, and position against the comp, each chrome strip's height off its rule, and the frame for ink where the comp is calm (a kicker, an extra nav item, a divider), and says each miss as a number ("cap height 78px in the build, 103px in the comp"); those numbers are the edit. When it fails, open the region crops it lists, in order, before editing: a region scored `missing` needs its material, `contradicted` needs its structure re-derived from the spec box, `drift` is where size and spacing edits belong; the gate refuses a third attempt that only nudges values on the same region. This is where the run's ambition is won or lost, and a retry here costs minutes where a rebuild verdict at the finish costs the run. <!-- rule:skill-hero-gate -->
|
||||
3. **hero.** `impeccable build-phase scaffold` first: it writes the measured layout as CSS custom properties (`.impeccable/build/scaffold/layout.css`: `--r-<id>-x/y/w/h` in % of the comp, plus cap height, font-size, family, and weight where measured) and a reference page (`hero-reference.html`) with every region at its box and every plate placed. Bind the numbers to your own semantic structure, an element per region; the reference is a check on positions, never the page, and overlapping boxes are overlapping boxes. Then build only the first viewport, at the comp's own dimensions, the comp's words copied verbatim (the user approved that comp with those words; rewording is a stated decision after the hero passes, never a silent one inside it), every text region sized from its measured cap height and set in its ranked face, plates first: place every plate at its spec box (`object-fit: cover`, an `<img>`, a background image, or an inlined data URI named for it) before any text or control, capture into `.impeccable/review/hero-repro.png`, run `impeccable build-phase record hero` once so you see the plate regions read as match before any text exists, then lay the semantic layer over the plates from the spec's palette and boxes and advance. The gate first refuses while any plate is unreferenced by the source, then runs `impeccable comp-diff`, writes `.impeccable/review/diff/hero/` (side-by-side, heatmap, one paired crop per region, `report.json`; `raw-report.json` preserves the uninterpreted measurements). The report and crop labels use the gate's verdicts; `gate.reasons` lists the remaining blockers even when a region is called drift. An accepted plate is revalidated if its file, measured region, or comp changes. The gate passes at 72% overall with no hard veto outstanding (a missing region, a contradicted plate or text block, an SVG illustration, a clipped plate, invented ink block at any score); above the bar, the numeric readings become advisories printed with the pass, and the polish pass before responsive is where they get fixed: the gate also reads each text region's cap height, line count, weight, ink colour, and position against the comp, each chrome strip's height off its rule, and the frame for ink where the comp is calm (a kicker, an extra nav item, a divider), and says each miss as a number ("cap height 78px in the build, 103px in the comp"); those numbers are the edit. When it fails, open the region crops it lists, in order, before editing: a region scored `missing` needs its material, `contradicted` needs its structure re-derived from the spec box, `drift` is where size and spacing edits belong; repeated attempts do not clear unresolved blockers. This is where the run's ambition is won or lost, and a retry here costs minutes where a rebuild verdict at the finish costs the run. <!-- rule:skill-hero-gate -->
|
||||
4. **sections.** Build the rest of the surface inside the spec's system: the same corner language, line weights, and palette, and nothing the comp never shows. Where the comp does not cover a region, it inherits the recorded system.
|
||||
5. **motion.** The signature interaction, reveals, and motion, orchestrated once rather than scattered.
|
||||
6. **responsive.** The other viewports, and the first viewport at common desktop widths (1280 to 1600), not only at the comp's exact size: fluid columns, no fixed-pixel grid that wraps a hundred pixels narrower. Capture `desktop.png` (1440 wide, full page) and `mobile.png` (390 wide) into `.impeccable/review/`; the gate diffs the desktop capture against the comp and refuses a first viewport that only held at the comp's width. A comp'd surface that is mobile-first was comped portrait; the plates were produced for that frame.
|
||||
|
||||
@@ -87,6 +87,11 @@ fi
|
||||
# Last resort: fetch this version's binary for the current platform from the
|
||||
# public release channel into the user cache. Needs network; sandboxes without
|
||||
# egress preinstall the binary on PATH instead.
|
||||
setup_help() {
|
||||
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
||||
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
||||
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
||||
}
|
||||
fetch_url() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL --retry 2 -o "$tmp" "$1" 2>/dev/null
|
||||
@@ -119,7 +124,18 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
[ "$os" = windows ] && asset="$asset.exe"
|
||||
url="$base/engine-v$version/$asset"
|
||||
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
||||
mkdir -p "$cache_root/bin/$version" 2>/dev/null
|
||||
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
# Check the actual staging file, not just directory existence: a cache from
|
||||
# an earlier run can be readable but no longer writable inside a sandbox.
|
||||
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
||||
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
fetched=0
|
||||
if fetch_url "$url"; then
|
||||
fetched=1
|
||||
@@ -180,6 +196,9 @@ if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
||||
exec "$cached" "$@"
|
||||
fi
|
||||
rm -f "$tmp" 2>/dev/null
|
||||
echo "impeccable: could not download engine $version from $url; check network access, the release URL, and curl or wget availability." >&2
|
||||
setup_help
|
||||
exit 127
|
||||
fi
|
||||
|
||||
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
||||
|
||||
@@ -68,18 +68,27 @@ rem another launcher's probe: fail fast and quiet instead.
|
||||
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
||||
if not defined version goto fail
|
||||
where curl.exe >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto curl_missing
|
||||
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
||||
if not exist "%IMPECCABLE_HOME%\bin\%version%" mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
||||
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
||||
if errorlevel 1 goto cache_directory_failed
|
||||
:cache_ready
|
||||
rem Check the staging file too: an existing directory may be read-only.
|
||||
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
||||
rem branch on the command's failure directly. Never treat a directory as a
|
||||
rem staging file (later del cleanup would prompt to delete its contents).
|
||||
if exist "%cached%.part\" goto cache_write_failed
|
||||
(type nul >"%cached%.part") 2>nul || goto cache_write_failed
|
||||
set "asset=impeccable-windows-%arch%.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if not errorlevel 1 goto verify
|
||||
if not "%arch%"=="arm64" goto fail
|
||||
if not "%arch%"=="arm64" goto download_failed
|
||||
set "asset=impeccable-windows-x64.exe"
|
||||
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
||||
curl.exe -fsSL -o "%cached%.part" "%url%" >nul 2>nul
|
||||
if errorlevel 1 goto fail
|
||||
if errorlevel 1 goto download_failed
|
||||
|
||||
:verify
|
||||
call :check_download
|
||||
@@ -176,6 +185,28 @@ if not errorlevel 1 set "probe_ok=1"
|
||||
del "%probe_tmp%" >nul 2>nul
|
||||
exit /b 0
|
||||
|
||||
:cache_directory_failed
|
||||
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:cache_write_failed
|
||||
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:curl_missing
|
||||
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
||||
goto setup_failed
|
||||
|
||||
:download_failed
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
||||
|
||||
:setup_failed
|
||||
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
||||
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
||||
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
||||
exit /b 127
|
||||
|
||||
:fail
|
||||
del "%cached%.part" >nul 2>nul
|
||||
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
||||
|
||||
@@ -29,8 +29,29 @@ async function exercise(t, scenario) {
|
||||
const launcher = path.join(scripts, name);
|
||||
fs.copyFileSync(path.join(ROOT, 'skill/scripts', name), launcher);
|
||||
const cacheDir = path.join(cache, 'bin', '0.0.0-test');
|
||||
if (scenario === 'cache-directory-failure') {
|
||||
// A file where the cache parent belongs makes mkdir fail on every OS,
|
||||
// including privileged test runners where chmod cannot deny writes.
|
||||
fs.mkdirSync(cache);
|
||||
fs.writeFileSync(path.join(cache, 'bin'), 'blocked');
|
||||
}
|
||||
if (scenario === 'cache-write-failure') {
|
||||
fs.mkdirSync(cacheDir, { recursive: true });
|
||||
if (WINDOWS) fs.mkdirSync(path.join(cacheDir, 'impeccable.exe.part'));
|
||||
}
|
||||
if (scenario === 'cache-readonly-file') {
|
||||
fs.mkdirSync(cacheDir, { recursive: true });
|
||||
const staging = path.join(cacheDir, 'impeccable.exe.part');
|
||||
fs.writeFileSync(staging, 'read-only');
|
||||
fs.chmodSync(staging, 0o444);
|
||||
}
|
||||
const tools = path.join(root, 'tools');
|
||||
fs.mkdirSync(tools);
|
||||
if (!WINDOWS && scenario === 'cache-write-failure') {
|
||||
// The POSIX staging name contains the launcher's PID, so intercept the
|
||||
// preceding mkdir to place a directory at precisely that file path.
|
||||
fs.writeFileSync(path.join(tools, 'mkdir'), '#!/bin/sh\n/bin/mkdir "$@" || exit $?\n/bin/mkdir "$IMPECCABLE_HOME/bin/0.0.0-test/.impeccable.part.$PPID"\n', { mode: 0o755 });
|
||||
}
|
||||
if (!WINDOWS && ['hash-failure', 'removed-during-hash'].includes(scenario)) {
|
||||
fs.writeFileSync(path.join(tools, 'shasum'),
|
||||
`#!/bin/sh\n${scenario === 'removed-during-hash' ? 'rm -f "$3"\n' : ''}printf '%s %s\\n' '${HASH}' "$3"\nexit ${scenario === 'hash-failure' ? 1 : 0}\n`,
|
||||
@@ -71,6 +92,10 @@ async function exercise(t, scenario) {
|
||||
const requests = [];
|
||||
const server = http.createServer((req, res) => {
|
||||
requests.push(req.url);
|
||||
if (scenario === 'transport-failure') {
|
||||
req.socket.destroy();
|
||||
return;
|
||||
}
|
||||
if (req.url.endsWith('.sha256')) {
|
||||
const part = fs.readdirSync(cacheDir).find(file => file.includes('.part'));
|
||||
if (scenario === 'removed') fs.unlinkSync(path.join(cacheDir, part));
|
||||
@@ -78,6 +103,7 @@ async function exercise(t, scenario) {
|
||||
res.writeHead(scenario === 'no-sidecar' ? 404 : 200);
|
||||
res.end(scenario === 'empty-sidecar' ? '' : `${scenario === 'mismatch' ? '0'.repeat(64) : HASH} engine\n`);
|
||||
} else {
|
||||
if (scenario === 'download-failure') res.writeHead(404);
|
||||
res.end(scenario === 'empty-download' ? '' : PAYLOAD);
|
||||
}
|
||||
});
|
||||
@@ -92,7 +118,7 @@ async function exercise(t, scenario) {
|
||||
IMPECCABLE_DOWNLOAD_BASE: `http://127.0.0.1:${server.address().port}`,
|
||||
...(WINDOWS ? { SystemRoot: process.env.SystemRoot, ComSpec: COMSPEC, PROCESSOR_ARCHITECTURE: 'AMD64' } : {}),
|
||||
};
|
||||
const result = await new Promise((resolve, reject) => {
|
||||
const run = () => new Promise((resolve, reject) => {
|
||||
const child = WINDOWS
|
||||
? spawn(COMSPEC, ['/d', '/s', '/c', `""${launcher}" /d /c echo verified-engine"`], { env, cwd: root, windowsVerbatimArguments: true, timeout: 20000 })
|
||||
: spawn('/bin/sh', [launcher], { env, cwd: root, timeout: 20000 });
|
||||
@@ -103,9 +129,41 @@ async function exercise(t, scenario) {
|
||||
child.on('error', reject);
|
||||
child.on('close', (status, signal) => resolve({ status, signal, stdout, stderr }));
|
||||
});
|
||||
const result = await run();
|
||||
if (scenario === 'valid') {
|
||||
const requestCount = requests.length;
|
||||
const cachedResult = await run();
|
||||
assert.equal(cachedResult.status, 0, cachedResult.stderr);
|
||||
assert.match(cachedResult.stdout, /verified-engine/);
|
||||
assert.equal(cachedResult.stderr, '', 'cached execution stays quiet');
|
||||
assert.equal(requests.length, requestCount, 'subsequent runs use the cached engine without network');
|
||||
}
|
||||
assert.equal(result.signal, null, JSON.stringify(result));
|
||||
assert.equal(requests.filter(url => !url.endsWith('.sha256')).length, 1, 'one binary download, no verification retry loop');
|
||||
return { ...result, files: fs.readdirSync(cacheDir), requests };
|
||||
const cacheFailure = scenario.startsWith('cache-');
|
||||
assert.equal(requests.filter(url => !url.endsWith('.sha256')).length, cacheFailure ? 0 : 1,
|
||||
'cache failures do not attempt a download; other scenarios download once');
|
||||
return { ...result, files: fs.existsSync(cacheDir) ? fs.readdirSync(cacheDir) : [], requests, cacheDir };
|
||||
}
|
||||
|
||||
for (const scenario of ['cache-directory-failure', 'cache-write-failure', 'download-failure', 'transport-failure', ...(WINDOWS ? ['cache-readonly-file'] : [])]) {
|
||||
test(`launcher explains ${scenario} and how to retry setup`, async t => {
|
||||
const result = await exercise(t, scenario);
|
||||
assert.equal(result.status, 127, JSON.stringify(result));
|
||||
assert.doesNotMatch(result.stdout, /verified-engine/);
|
||||
assert.match(result.stderr, /engine 0\.0\.0-test/);
|
||||
assert.ok(result.stderr.includes(result.cacheDir), result.stderr);
|
||||
assert.match(result.stderr, /engine-probe/);
|
||||
assert.match(result.stderr, /IMPECCABLE_HOME/);
|
||||
assert.match(result.stderr, /IMPECCABLE_BIN/);
|
||||
if (['download-failure', 'transport-failure'].includes(scenario)) {
|
||||
assert.match(result.stderr, /could not download/);
|
||||
assert.match(result.stderr, /network/);
|
||||
assert.deepEqual(result.files, [], 'failed downloads leave no staging files');
|
||||
assert.equal(result.requests.length, 1, 'no verification without a download');
|
||||
} else {
|
||||
assert.match(result.stderr, scenario === 'cache-directory-failure' ? /cannot create/ : /cannot write/);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
test('launcher downloads and runs a verified executable', async t => {
|
||||
|
||||
@@ -164,3 +164,15 @@ installed. The binary's `CLI_VERSION` moves from `3.6.0` to `4.0.0` with the
|
||||
CLI 4.0.0 release; it is what the binary prints when run directly.
|
||||
|
||||
- `cli-version`.
|
||||
|
||||
## Recorded 2026-09-11: comp regions no longer include neighbouring pixels
|
||||
|
||||
The `comp-diff-no-spec` golden now measures the automatic bands at their actual
|
||||
bounds rather than enlarging bands under 48px. Reviewed changes are confined to
|
||||
regional scores and ink boxes: the second band's overall is 0.6755 (was 0.6951),
|
||||
the fourth is 1.0 (was 0.9468), and narrow-band ink boxes use the corrected crop
|
||||
coordinates. Whole-frame scores, verdicts, region definitions, exit status, and
|
||||
stderr are unchanged. The golden was updated to enforce these exact results;
|
||||
this is not an open-ended accepted delta. Frozen function call vectors remain
|
||||
unchanged. The Rust narrow-region regression independently checks that changing
|
||||
only neighbouring pixels leaves the measured crop identical.
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user