vc-extras 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -71
- package/agent-install.mjs +159 -0
- package/agents/tester.md +23 -23
- package/install-extras.mjs +41 -109
- package/install-menu.mjs +22 -43
- package/install-skills.mjs +112 -112
- package/package.json +72 -28
- package/plugin-registry.mjs +73 -0
- package/plugins/config-ui/index.ts +159 -159
- package/plugins/config-ui/lib/arguments.mjs +24 -24
- package/plugins/config-ui/lib/documents.mjs +67 -67
- package/plugins/config-ui/lib/frontmatter.mjs +91 -91
- package/plugins/config-ui/lib/open.mjs +16 -16
- package/plugins/config-ui/lib/ownership.mjs +99 -99
- package/plugins/config-ui/lib/page.mjs +11 -11
- package/plugins/config-ui/lib/patch.mjs +35 -35
- package/plugins/config-ui/lib/paths.mjs +14 -14
- package/plugins/config-ui/lib/plugin-fields.mjs +86 -86
- package/plugins/config-ui/lib/plugin-validation.mjs +28 -28
- package/plugins/config-ui/lib/redaction.mjs +8 -8
- package/plugins/config-ui/lib/registry.mjs +282 -282
- package/plugins/config-ui/lib/secrets.mjs +44 -44
- package/plugins/config-ui/lib/server.mjs +250 -250
- package/plugins/config-ui/lib/sources.mjs +96 -96
- package/plugins/config-ui/lib/state.mjs +156 -156
- package/plugins/config-ui/lib/themes.mjs +113 -113
- package/plugins/config-ui/lib/writer.mjs +690 -690
- package/plugins/config-ui/project-local-owner.ts +106 -106
- package/plugins/config-ui/vc-extras.plugin.json +13 -0
- package/plugins/config-ui/web/app.mjs +997 -997
- package/plugins/config-ui/web/index.html +342 -342
- package/plugins/pi-blackhole/vc-extras.plugin.json +12 -0
- package/plugins/pi-btw/vc-extras.plugin.json +12 -0
- package/plugins/pi-claude-code/vc-extras.plugin.json +12 -0
- package/plugins/pi-fff/vc-extras.plugin.json +12 -0
- package/plugins/pi-jev-auto-mode/vc-extras.plugin.json +12 -0
- package/plugins/pi-mcp-adapter/vc-extras.plugin.json +12 -0
- package/plugins/pi-web-access/vc-extras.plugin.json +12 -0
- package/plugins/vc-ask/claude-hook.mjs +37 -0
- package/plugins/vc-ask/codex-native.mjs +28 -0
- package/plugins/vc-ask/host-channel.mjs +75 -0
- package/plugins/vc-ask/index.ts +57 -0
- package/plugins/vc-ask/native-questions.mjs +33 -0
- package/plugins/vc-ask/package.json +10 -0
- package/plugins/vc-ask/payload.ts +170 -0
- package/plugins/vc-ask/questionnaire/LICENSE.ask-user-question +21 -0
- package/plugins/vc-ask/questionnaire/UPSTREAM.md +104 -0
- package/plugins/vc-ask/questionnaire/answer-channel.ts +135 -0
- package/plugins/vc-ask/questionnaire/config.ts +180 -0
- package/plugins/vc-ask/questionnaire/events.ts +154 -0
- package/plugins/vc-ask/questionnaire/execute.ts +688 -0
- package/plugins/vc-ask/questionnaire/i18n.ts +73 -0
- package/plugins/vc-ask/questionnaire/inline-entry.ts +312 -0
- package/plugins/vc-ask/questionnaire/locales/de.json +43 -0
- package/plugins/vc-ask/questionnaire/locales/en.json +42 -0
- package/plugins/vc-ask/questionnaire/locales/es.json +43 -0
- package/plugins/vc-ask/questionnaire/locales/fr.json +43 -0
- package/plugins/vc-ask/questionnaire/locales/pt-BR.json +43 -0
- package/plugins/vc-ask/questionnaire/locales/pt.json +43 -0
- package/plugins/vc-ask/questionnaire/locales/ru.json +43 -0
- package/plugins/vc-ask/questionnaire/locales/uk.json +43 -0
- package/plugins/vc-ask/questionnaire/locales/zh.json +46 -0
- package/plugins/vc-ask/questionnaire/presentation.ts +11 -0
- package/plugins/vc-ask/questionnaire/question-preview.ts +6 -0
- package/plugins/vc-ask/questionnaire/rpc.ts +221 -0
- package/plugins/vc-ask/questionnaire/session-timeout.ts +67 -0
- package/plugins/vc-ask/questionnaire/state/build-questionnaire.ts +144 -0
- package/plugins/vc-ask/questionnaire/state/external-editor.ts +62 -0
- package/plugins/vc-ask/questionnaire/state/geometry.ts +131 -0
- package/plugins/vc-ask/questionnaire/state/key-router.ts +382 -0
- package/plugins/vc-ask/questionnaire/state/panel-router.ts +32 -0
- package/plugins/vc-ask/questionnaire/state/questionnaire-session.ts +642 -0
- package/plugins/vc-ask/questionnaire/state/row-intent.ts +143 -0
- package/plugins/vc-ask/questionnaire/state/selectors/contract.ts +24 -0
- package/plugins/vc-ask/questionnaire/state/selectors/derivations.ts +40 -0
- package/plugins/vc-ask/questionnaire/state/selectors/focus.ts +17 -0
- package/plugins/vc-ask/questionnaire/state/selectors/projections.ts +99 -0
- package/plugins/vc-ask/questionnaire/state/state-reducer.ts +455 -0
- package/plugins/vc-ask/questionnaire/state/state.ts +90 -0
- package/plugins/vc-ask/questionnaire/state/vertical.ts +158 -0
- package/plugins/vc-ask/questionnaire/timeout.ts +59 -0
- package/plugins/vc-ask/questionnaire/tool/external-answer.ts +103 -0
- package/plugins/vc-ask/questionnaire/tool/format-answer.ts +24 -0
- package/plugins/vc-ask/questionnaire/tool/normalize-params.ts +37 -0
- package/plugins/vc-ask/questionnaire/tool/response-envelope.ts +75 -0
- package/plugins/vc-ask/questionnaire/tool/types.ts +74 -0
- package/plugins/vc-ask/questionnaire/tool/validate-questionnaire.ts +75 -0
- package/plugins/vc-ask/questionnaire/view/card-theme.ts +245 -0
- package/plugins/vc-ask/questionnaire/view/components/inline-input.ts +66 -0
- package/plugins/vc-ask/questionnaire/view/components/multi-select-view.ts +177 -0
- package/plugins/vc-ask/questionnaire/view/components/option-list-view.ts +65 -0
- package/plugins/vc-ask/questionnaire/view/components/preview/markdown-content-cache.ts +101 -0
- package/plugins/vc-ask/questionnaire/view/components/preview/preview-block-renderer.ts +130 -0
- package/plugins/vc-ask/questionnaire/view/components/preview/preview-box-renderer.ts +86 -0
- package/plugins/vc-ask/questionnaire/view/components/preview/preview-layout-decider.ts +204 -0
- package/plugins/vc-ask/questionnaire/view/components/preview/preview-pane.ts +257 -0
- package/plugins/vc-ask/questionnaire/view/components/submit-picker.ts +65 -0
- package/plugins/vc-ask/questionnaire/view/components/tab-bar.ts +57 -0
- package/plugins/vc-ask/questionnaire/view/components/wrapping-select.ts +269 -0
- package/plugins/vc-ask/questionnaire/view/dialog-builder.ts +319 -0
- package/plugins/vc-ask/questionnaire/view/document-theme.ts +53 -0
- package/plugins/vc-ask/questionnaire/view/document-view.ts +306 -0
- package/plugins/vc-ask/questionnaire/view/panel-chrome.ts +133 -0
- package/plugins/vc-ask/questionnaire/view/props-adapter.ts +77 -0
- package/plugins/vc-ask/questionnaire/view/stateful-view.ts +24 -0
- package/plugins/vc-ask/questionnaire/view/tab-components.ts +16 -0
- package/plugins/vc-ask/questionnaire/view/tab-content-strategy.ts +280 -0
- package/plugins/vc-ask/questionnaire/view/vertical-view.ts +218 -0
- package/plugins/vc-ask/user-input-events.ts +34 -0
- package/plugins/vc-ask/vc-extras.plugin.json +18 -0
- package/plugins/vc-footer/agents/claude-code/adapter.mjs +29 -0
- package/plugins/vc-footer/agents/claude-code/cli.mjs +23 -0
- package/plugins/vc-footer/agents/claude-code/renderer.mjs +1 -0
- package/plugins/vc-footer/agents/claude-code/types.d.ts +38 -0
- package/plugins/vc-footer/agents/codex/adapter.mjs +13 -0
- package/plugins/vc-footer/agents/codex/mcp.mjs +45 -0
- package/plugins/vc-footer/agents/codex/native.mjs +19 -0
- package/plugins/vc-footer/agents/codex/renderer.mjs +2 -0
- package/plugins/vc-footer/agents/pi/adapter.mjs +23 -0
- package/plugins/vc-footer/agents/pi/index.js +84 -0
- package/plugins/vc-footer/agents/pi/project-local-owner.mjs +97 -0
- package/plugins/vc-footer/agents/pi/renderer.mjs +5 -0
- package/plugins/vc-footer/core/data.mjs +218 -0
- package/plugins/vc-footer/core/render.mjs +291 -0
- package/plugins/vc-footer/core/types.d.ts +29 -0
- package/plugins/vc-footer/package.json +22 -0
- package/plugins/vc-footer/vc-extras.plugin.json +32 -0
- package/skills/animate/LICENSE +21 -21
- package/skills/animate/RECIPES.md +324 -324
- package/skills/animate/SKILL.md +208 -208
- package/skills/animate/UPSTREAM.md +19 -19
- package/skills/animation-performance/LICENSE +21 -21
- package/skills/animation-performance/SKILL.md +223 -223
- package/skills/animation-performance/UPSTREAM.md +19 -19
- package/skills/answer-me-with-html/SKILL.md +174 -174
- package/skills/answer-me-with-html/scripts/am.mjs +12896 -12896
- package/skills/apple-design/LICENSE +21 -21
- package/skills/apple-design/SKILL.md +291 -291
- package/skills/apple-design/UPSTREAM.md +19 -19
- package/skills/bad-smell/SKILL.md +44 -44
- package/skills/commit/SKILL.md +90 -90
- package/skills/emil-design-eng/LICENSE +21 -21
- package/skills/emil-design-eng/SKILL.md +677 -677
- package/skills/emil-design-eng/UPSTREAM.md +19 -19
- package/skills/find-the-truth/SKILL.md +38 -38
- package/skills/find-the-truth/references/trace-method.md +48 -48
- package/skills/find-the-truth/references/truth-method.md +39 -39
- package/skills/gestures/LICENSE +21 -21
- package/skills/gestures/SKILL.md +107 -107
- package/skills/gestures/UPSTREAM.md +19 -19
- package/skills/humanizer-zh/LICENSE +21 -21
- package/skills/humanizer-zh/SKILL.md +409 -409
- package/skills/humanizer-zh/UPSTREAM.md +7 -7
- package/skills/impeccable/LICENSE +191 -191
- package/skills/impeccable/NOTICE.md +11 -11
- package/skills/impeccable/SKILL.md +89 -89
- package/skills/impeccable/licenses/modern-screenshot-MIT.txt +8 -8
- package/skills/impeccable/licenses/platform-design-skills-MIT.txt +21 -21
- package/skills/impeccable/reference/adapt.md +318 -318
- package/skills/impeccable/reference/adapt.native.md +58 -58
- package/skills/impeccable/reference/android.md +46 -46
- package/skills/impeccable/reference/animate.md +89 -89
- package/skills/impeccable/reference/audit.md +139 -139
- package/skills/impeccable/reference/audit.native.md +139 -139
- package/skills/impeccable/reference/bolder.md +33 -33
- package/skills/impeccable/reference/clarify.md +94 -94
- package/skills/impeccable/reference/colorize.md +86 -86
- package/skills/impeccable/reference/component-review.md +63 -63
- package/skills/impeccable/reference/craft-floor.md +44 -44
- package/skills/impeccable/reference/craft.md +5 -5
- package/skills/impeccable/reference/critique.md +819 -819
- package/skills/impeccable/reference/degraded/asset-producer.md +41 -41
- package/skills/impeccable/reference/degraded/documenter.md +23 -23
- package/skills/impeccable/reference/degraded/finish-reviewer.md +37 -37
- package/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -92
- package/skills/impeccable/reference/delight.md +70 -70
- package/skills/impeccable/reference/distill.md +111 -111
- package/skills/impeccable/reference/doctor.md +54 -54
- package/skills/impeccable/reference/document.md +416 -416
- package/skills/impeccable/reference/extract.md +69 -69
- package/skills/impeccable/reference/generate.md +101 -101
- package/skills/impeccable/reference/harden.md +362 -362
- package/skills/impeccable/reference/hooks.md +114 -114
- package/skills/impeccable/reference/init.md +131 -131
- package/skills/impeccable/reference/ios.md +51 -51
- package/skills/impeccable/reference/layout.md +84 -84
- package/skills/impeccable/reference/live-setup.md +104 -104
- package/skills/impeccable/reference/live.md +327 -327
- package/skills/impeccable/reference/mode-operate.md +21 -21
- package/skills/impeccable/reference/mode-persuade.md +19 -19
- package/skills/impeccable/reference/mode-read.md +21 -21
- package/skills/impeccable/reference/new-work.md +152 -152
- package/skills/impeccable/reference/onboard.md +234 -234
- package/skills/impeccable/reference/operate.md +61 -61
- package/skills/impeccable/reference/optimize.md +257 -257
- package/skills/impeccable/reference/overdrive.md +127 -127
- package/skills/impeccable/reference/polish.md +105 -105
- package/skills/impeccable/reference/quieter.md +99 -99
- package/skills/impeccable/reference/region-map.md +26 -26
- package/skills/impeccable/reference/routing.md +24 -24
- package/skills/impeccable/reference/shape.md +59 -59
- package/skills/impeccable/reference/typeset.md +90 -90
- package/skills/impeccable/reference/visualize.md +47 -47
- package/skills/impeccable/scripts/VERSION +1 -1
- package/skills/impeccable/scripts/command-metadata.json +98 -98
- package/skills/impeccable/scripts/data/font-index-failures.json +120 -120
- package/skills/impeccable/scripts/engine-checksums.txt +9 -9
- package/skills/impeccable/scripts/impeccable +249 -249
- package/skills/impeccable/scripts/impeccable.cmd +278 -278
- package/skills/impeccable/scripts/live-browser-dom.js +320 -320
- package/skills/impeccable/scripts/live-browser-ignores.js +246 -246
- package/skills/impeccable/scripts/live-browser-session.js +183 -183
- package/skills/impeccable/scripts/live-browser.js +13862 -13862
- package/skills/impeccable/scripts/modern-screenshot.umd.js +14 -14
- package/skills/improve-animations/AUDIT.md +115 -115
- package/skills/improve-animations/LICENSE +21 -21
- package/skills/improve-animations/PLAN-TEMPLATE.md +73 -73
- package/skills/improve-animations/SKILL.md +110 -110
- package/skills/improve-animations/UPSTREAM.md +19 -19
- package/skills/pick-ui-library/LICENSE +21 -21
- package/skills/pick-ui-library/SKILL.md +85 -85
- package/skills/pick-ui-library/UPSTREAM.md +19 -19
- package/skills/review-animations/LICENSE +21 -21
- package/skills/review-animations/SKILL.md +120 -120
- package/skills/review-animations/STANDARDS.md +187 -187
- package/skills/review-animations/UPSTREAM.md +19 -19
- package/skills/test/SKILL.md +29 -29
- package/skills/test/references/test-method.md +60 -60
- package/skills/write-doc/SKILL.md +115 -115
- package/skills/write-doc/examples/result-report.md +53 -53
- package/skills/write-doc/examples/task-summary.md +45 -45
- package/skills/write-doc/references/terminology.md +147 -147
- package/specs/ask-host-protocol-v1.md +58 -0
- package/specs/design-demo.md +1102 -1102
- package/specs/frontend-immersive.md +28 -28
- package/specs/plugin-install-v2.md +123 -0
- package/specs/plugin-install.md +38 -0
- package/specs/web-modes/explore.md +31 -31
- package/specs/web-modes/risk.md +15 -15
- package/specs/web-modes/verify.md +16 -16
- package/vc-extras.mjs +46 -62
- package/plugins/essrj/context.ts +0 -47
- package/plugins/essrj/data.ts +0 -190
- package/plugins/essrj/index.ts +0 -139
- package/plugins/essrj/package.json +0 -12
- package/plugins/essrj/project-local-owner.ts +0 -106
- package/plugins/essrj/render.ts +0 -217
- package/plugins/essrj/types.ts +0 -40
- package/plugins.json +0 -38
|
@@ -1,278 +1,278 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
setlocal
|
|
3
|
-
rem Impeccable launcher (Windows). Runs bin\windows-<arch>\impeccable.exe next
|
|
4
|
-
rem to this file, else a cached or freshly downloaded engine binary.
|
|
5
|
-
rem
|
|
6
|
-
rem Structure notes (this file is exercised by dry parsing and string-level
|
|
7
|
-
rem tests, not yet on a real Windows machine):
|
|
8
|
-
rem - No multi-line parenthesized blocks: cmd expands %var% at block parse
|
|
9
|
-
rem time, which made the old download path read back empty %url%/%cached%.
|
|
10
|
-
rem Linear goto flow keeps every expansion on its own line, and avoids
|
|
11
|
-
rem delayed expansion eating ! characters in user arguments.
|
|
12
|
-
rem - The unversioned user binary and the PATH candidate are validated with
|
|
13
|
-
rem the engine-probe handshake (see :probe) so the retired 3.x npm CLI,
|
|
14
|
-
rem whose bin is also named impeccable, is never exec'd. IMPECCABLE_BIN,
|
|
15
|
-
rem the sibling binary, and the version-pinned cache stay trusted.
|
|
16
|
-
rem - Downloads and the version-pinned cache are verified via certutil
|
|
17
|
-
rem against engine-checksums.txt next to this file, and fail closed; a
|
|
18
|
-
rem .verified stamp lets later runs skip hashing the cache. On ARM64 the
|
|
19
|
-
rem arm64 asset is tried first and the x64 asset is the fallback (Windows on
|
|
20
|
-
rem ARM runs x64 binaries), each only when the manifest has a line for it.
|
|
21
|
-
if not defined IMPECCABLE_SKILL_DIR set "IMPECCABLE_SKILL_DIR=%~dp0.."
|
|
22
|
-
if not defined IMPECCABLE_SELF set "IMPECCABLE_SELF=%~f0"
|
|
23
|
-
set "arch=x64"
|
|
24
|
-
if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "arch=arm64"
|
|
25
|
-
|
|
26
|
-
if not defined IMPECCABLE_BIN goto no_env_bin
|
|
27
|
-
if not exist "%IMPECCABLE_BIN%" goto no_env_bin
|
|
28
|
-
set "run=%IMPECCABLE_BIN%"
|
|
29
|
-
goto run
|
|
30
|
-
:no_env_bin
|
|
31
|
-
|
|
32
|
-
set "bin=%~dp0bin\windows-%arch%\impeccable.exe"
|
|
33
|
-
if not exist "%bin%" goto no_sibling
|
|
34
|
-
set "run=%bin%"
|
|
35
|
-
goto run
|
|
36
|
-
:no_sibling
|
|
37
|
-
|
|
38
|
-
set "home_bin=%USERPROFILE%\.impeccable\bin\impeccable.exe"
|
|
39
|
-
if not exist "%home_bin%" goto no_home_bin
|
|
40
|
-
if defined IMPECCABLE_LAUNCHER_PROBE goto no_home_bin
|
|
41
|
-
call :probe "%home_bin%"
|
|
42
|
-
if not "%probe_ok%"=="1" goto no_home_bin
|
|
43
|
-
set "run=%home_bin%"
|
|
44
|
-
goto run
|
|
45
|
-
:no_home_bin
|
|
46
|
-
|
|
47
|
-
set "version="
|
|
48
|
-
if exist "%~dp0VERSION" set /p version=<"%~dp0VERSION"
|
|
49
|
-
if not defined IMPECCABLE_HOME set "IMPECCABLE_HOME=%USERPROFILE%\.impeccable"
|
|
50
|
-
set "cached=%IMPECCABLE_HOME%\bin\%version%\impeccable.exe"
|
|
51
|
-
set "asset=impeccable-windows-%arch%.exe"
|
|
52
|
-
set "manifest=%~dp0engine-checksums.txt"
|
|
53
|
-
if not defined version goto no_cache
|
|
54
|
-
if not exist "%cached%" goto no_cache
|
|
55
|
-
if exist "%cached%.verified" goto cache_trusted
|
|
56
|
-
call :read_expected
|
|
57
|
-
call :sha256 "%cached%" "%TEMP%\impeccable-hash-%RANDOM%%RANDOM%.txt"
|
|
58
|
-
if not defined actual goto cache_unverified
|
|
59
|
-
if /I "%actual%"=="%expected%" goto cache_verified
|
|
60
|
-
if /I "%actual%"=="%expected_x64%" goto cache_verified
|
|
61
|
-
:cache_unverified
|
|
62
|
-
echo impeccable: cannot verify the cached engine "%cached%" against "%manifest%"; not using it 1>&2
|
|
63
|
-
goto no_cache
|
|
64
|
-
:cache_verified
|
|
65
|
-
(>"%cached%.verified" echo %actual%) 2>nul
|
|
66
|
-
:cache_trusted
|
|
67
|
-
set "run=%cached%"
|
|
68
|
-
goto run
|
|
69
|
-
:no_cache
|
|
70
|
-
|
|
71
|
-
if defined IMPECCABLE_LAUNCHER_PROBE goto download
|
|
72
|
-
where impeccable >nul 2>nul
|
|
73
|
-
if errorlevel 1 goto download
|
|
74
|
-
call :probe impeccable
|
|
75
|
-
if not "%probe_ok%"=="1" goto download
|
|
76
|
-
impeccable %*
|
|
77
|
-
exit /b %errorlevel%
|
|
78
|
-
|
|
79
|
-
:download
|
|
80
|
-
rem Last resort: fetch this version's binary from the release channel into
|
|
81
|
-
rem the version-pinned user cache, verify it, then run it. Never inside
|
|
82
|
-
rem another launcher's probe: fail fast and quiet instead.
|
|
83
|
-
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
|
84
|
-
if not defined version goto fail
|
|
85
|
-
call :read_expected
|
|
86
|
-
if not defined expected if not defined expected_x64 goto no_checksum
|
|
87
|
-
where curl.exe >nul 2>nul
|
|
88
|
-
if errorlevel 1 goto curl_missing
|
|
89
|
-
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
|
90
|
-
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
|
91
|
-
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
|
92
|
-
if errorlevel 1 goto cache_directory_failed
|
|
93
|
-
:cache_ready
|
|
94
|
-
rem Stage the download in a directory only this run owns, as the sh launcher
|
|
95
|
-
rem does with .impeccable.part.$$: concurrent first runs (parallel hooks, two
|
|
96
|
-
rem agents) must never write, hash or move each other's files. mkdir fails
|
|
97
|
-
rem when the name exists, so it claims the name atomically. RANDOM alone is
|
|
98
|
-
rem not enough because cmd seeds it from the clock in whole seconds; the
|
|
99
|
-
rem timestamp and the retry on collision keep same-second runs apart. A cache
|
|
100
|
-
rem directory that refuses every mkdir is reported as unwritable.
|
|
101
|
-
set "attempt=0"
|
|
102
|
-
:claim_staging
|
|
103
|
-
set /a attempt+=1
|
|
104
|
-
if %attempt% GTR 20 goto cache_write_failed
|
|
105
|
-
set "stamp=%TIME: =0%"
|
|
106
|
-
set "stamp=%stamp::=%"
|
|
107
|
-
set "stamp=%stamp:.=%"
|
|
108
|
-
set "stamp=%stamp:,=%"
|
|
109
|
-
set "staging=%IMPECCABLE_HOME%\bin\%version%\.impeccable.part.%stamp%-%RANDOM%%RANDOM%"
|
|
110
|
-
mkdir "%staging%" >nul 2>nul
|
|
111
|
-
if errorlevel 1 goto claim_staging
|
|
112
|
-
set "part=%staging%\impeccable.exe"
|
|
113
|
-
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
|
114
|
-
rem branch on the command's failure directly.
|
|
115
|
-
(type nul >"%part%") 2>nul || goto staging_write_failed
|
|
116
|
-
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
|
117
|
-
if not defined expected goto fetch_x64
|
|
118
|
-
curl.exe -fsSL -o "%part%" "%url%" >nul 2>nul
|
|
119
|
-
if not errorlevel 1 goto verify
|
|
120
|
-
:fetch_x64
|
|
121
|
-
if not defined expected_x64 goto download_failed
|
|
122
|
-
set "asset=impeccable-windows-x64.exe"
|
|
123
|
-
set "expected=%expected_x64%"
|
|
124
|
-
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
|
125
|
-
curl.exe -fsSL -o "%part%" "%url%" >nul 2>nul
|
|
126
|
-
if errorlevel 1 goto download_failed
|
|
127
|
-
|
|
128
|
-
:verify
|
|
129
|
-
call :check_download
|
|
130
|
-
if errorlevel 1 exit /b 127
|
|
131
|
-
rem Mirrors the sh launcher and fails closed: a freshly downloaded binary
|
|
132
|
-
rem runs only after its hash matches the digest read from engine-checksums.txt.
|
|
133
|
-
rem An empty certutil result refuses the download instead of running an
|
|
134
|
-
rem unverified binary.
|
|
135
|
-
call :sha256 "%part%" "%staging%\hash.txt"
|
|
136
|
-
call :check_download
|
|
137
|
-
if errorlevel 1 exit /b 127
|
|
138
|
-
if not defined actual goto verify_refuse
|
|
139
|
-
if /I "%actual%"=="%expected%" goto place
|
|
140
|
-
call :discard_staging
|
|
141
|
-
echo impeccable: checksum mismatch downloading %url% 1>&2
|
|
142
|
-
exit /b 127
|
|
143
|
-
|
|
144
|
-
:verify_refuse
|
|
145
|
-
call :check_download
|
|
146
|
-
if errorlevel 1 exit /b 127
|
|
147
|
-
call :discard_staging
|
|
148
|
-
echo impeccable: cannot verify %url% (certutil could not hash it); refusing the unverified download 1>&2
|
|
149
|
-
exit /b 127
|
|
150
|
-
|
|
151
|
-
:read_expected
|
|
152
|
-
rem Sets expected (and, on ARM64, expected_x64: Windows on ARM runs x64
|
|
153
|
-
rem binaries) from engine-checksums.txt. Only called off the stamped path:
|
|
154
|
-
rem hooks run this launcher on every edit.
|
|
155
|
-
call :manifest_digest "%asset%" expected
|
|
156
|
-
set "expected_x64="
|
|
157
|
-
if "%arch%"=="arm64" call :manifest_digest impeccable-windows-x64.exe expected_x64
|
|
158
|
-
exit /b 0
|
|
159
|
-
|
|
160
|
-
:manifest_digest
|
|
161
|
-
rem Sets the variable named %2 to the digest the first engine-checksums.txt
|
|
162
|
-
rem line for this version and asset %1 records, empty when there is none.
|
|
163
|
-
set "%~2="
|
|
164
|
-
if not exist "%manifest%" exit /b 0
|
|
165
|
-
for /f "usebackq tokens=1-3" %%a in ("%manifest%") do if "%%a"=="%version%" if /I "%%b"=="%~1" if not defined %~2 set "%~2=%%c"
|
|
166
|
-
exit /b 0
|
|
167
|
-
|
|
168
|
-
:sha256
|
|
169
|
-
rem Sets actual to the sha256 of %~1, empty when certutil fails. %~2 is the
|
|
170
|
-
rem scratch file for its output. Check certutil's status before parsing: its
|
|
171
|
-
rem error text on stdout is not a digest.
|
|
172
|
-
set "actual="
|
|
173
|
-
certutil -hashfile "%~1" SHA256 >"%~2" 2>nul
|
|
174
|
-
if errorlevel 1 goto sha256_done
|
|
175
|
-
for /f "usebackq skip=1 delims=" %%h in ("%~2") do if not defined actual set "actual=%%h"
|
|
176
|
-
if not defined actual goto sha256_done
|
|
177
|
-
set "actual=%actual: =%"
|
|
178
|
-
:sha256_done
|
|
179
|
-
del "%~2" >nul 2>nul
|
|
180
|
-
exit /b 0
|
|
181
|
-
|
|
182
|
-
:check_download
|
|
183
|
-
set "download_file=%~1"
|
|
184
|
-
if not defined download_file set "download_file=%part%"
|
|
185
|
-
if not exist "%download_file%" goto download_missing
|
|
186
|
-
for %%f in ("%download_file%") do if %%~zf==0 goto download_empty
|
|
187
|
-
exit /b 0
|
|
188
|
-
|
|
189
|
-
:download_missing
|
|
190
|
-
call :discard_staging
|
|
191
|
-
echo impeccable: download completed but the file was removed before execution: %url%; check your antivirus quarantine or logs. Refusing to continue; do not disable protection. 1>&2
|
|
192
|
-
exit /b 127
|
|
193
|
-
|
|
194
|
-
:download_empty
|
|
195
|
-
del "%download_file%" >nul 2>nul
|
|
196
|
-
call :discard_staging
|
|
197
|
-
echo impeccable: downloaded file is empty: %url%; refusing the unverified download 1>&2
|
|
198
|
-
exit /b 127
|
|
199
|
-
|
|
200
|
-
:discard_staging
|
|
201
|
-
rem Removes this run's staging directory and whatever is left in it. Never
|
|
202
|
-
rem touches another run's staging directory or the cached binary.
|
|
203
|
-
if defined staging rd /s /q "%staging%" >nul 2>nul
|
|
204
|
-
exit /b 0
|
|
205
|
-
|
|
206
|
-
:place
|
|
207
|
-
call :check_download
|
|
208
|
-
if errorlevel 1 exit /b 127
|
|
209
|
-
move /y "%part%" "%cached%" >nul 2>nul
|
|
210
|
-
if errorlevel 1 goto place_failed
|
|
211
|
-
call :discard_staging
|
|
212
|
-
call :check_download "%cached%"
|
|
213
|
-
if errorlevel 1 exit /b 127
|
|
214
|
-
(>"%cached%.verified" echo %actual%) 2>nul
|
|
215
|
-
set "run=%cached%"
|
|
216
|
-
goto run
|
|
217
|
-
|
|
218
|
-
:place_failed
|
|
219
|
-
call :check_download
|
|
220
|
-
if errorlevel 1 exit /b 127
|
|
221
|
-
call :discard_staging
|
|
222
|
-
echo impeccable: could not cache the verified download: %url% 1>&2
|
|
223
|
-
exit /b 127
|
|
224
|
-
|
|
225
|
-
:run
|
|
226
|
-
"%run%" %*
|
|
227
|
-
exit /b %errorlevel%
|
|
228
|
-
|
|
229
|
-
:probe
|
|
230
|
-
rem Sets probe_ok=1 when %1 answers the engine handshake: prints
|
|
231
|
-
rem "impeccable-engine <version>" and exits 0. The 3.x npm CLI answers any
|
|
232
|
-
rem unknown verb with "Unknown command", exit 1, so it never passes.
|
|
233
|
-
set "probe_ok="
|
|
234
|
-
set "probe_tmp=%TEMP%\impeccable-probe-%RANDOM%%RANDOM%.txt"
|
|
235
|
-
set "IMPECCABLE_LAUNCHER_PROBE=1"
|
|
236
|
-
"%~1" engine-probe >"%probe_tmp%" 2>nul
|
|
237
|
-
set "probe_err=%ERRORLEVEL%"
|
|
238
|
-
set "IMPECCABLE_LAUNCHER_PROBE="
|
|
239
|
-
if not "%probe_err%"=="0" goto probe_done
|
|
240
|
-
findstr /b /c:"impeccable-engine" "%probe_tmp%" >nul 2>nul
|
|
241
|
-
if not errorlevel 1 set "probe_ok=1"
|
|
242
|
-
:probe_done
|
|
243
|
-
del "%probe_tmp%" >nul 2>nul
|
|
244
|
-
exit /b 0
|
|
245
|
-
|
|
246
|
-
:no_checksum
|
|
247
|
-
echo impeccable: no checksum for engine %version% (%asset%) in "%manifest%"; refusing the unverified download 1>&2
|
|
248
|
-
exit /b 127
|
|
249
|
-
|
|
250
|
-
:cache_directory_failed
|
|
251
|
-
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
|
252
|
-
goto setup_failed
|
|
253
|
-
|
|
254
|
-
:staging_write_failed
|
|
255
|
-
call :discard_staging
|
|
256
|
-
|
|
257
|
-
:cache_write_failed
|
|
258
|
-
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
|
259
|
-
goto setup_failed
|
|
260
|
-
|
|
261
|
-
:curl_missing
|
|
262
|
-
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
|
263
|
-
goto setup_failed
|
|
264
|
-
|
|
265
|
-
:download_failed
|
|
266
|
-
call :discard_staging
|
|
267
|
-
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
|
268
|
-
|
|
269
|
-
:setup_failed
|
|
270
|
-
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
|
271
|
-
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
|
272
|
-
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
|
273
|
-
exit /b 127
|
|
274
|
-
|
|
275
|
-
:fail
|
|
276
|
-
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
|
277
|
-
echo Download impeccable-windows-%arch%.exe from https://github.com/pbakaus/impeccable/releases (tag engine-v%version%) and save it as %cached%, or set IMPECCABLE_BIN to a preinstalled engine binary. Docs: https://impeccable.style 1>&2
|
|
278
|
-
exit /b 127
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal
|
|
3
|
+
rem Impeccable launcher (Windows). Runs bin\windows-<arch>\impeccable.exe next
|
|
4
|
+
rem to this file, else a cached or freshly downloaded engine binary.
|
|
5
|
+
rem
|
|
6
|
+
rem Structure notes (this file is exercised by dry parsing and string-level
|
|
7
|
+
rem tests, not yet on a real Windows machine):
|
|
8
|
+
rem - No multi-line parenthesized blocks: cmd expands %var% at block parse
|
|
9
|
+
rem time, which made the old download path read back empty %url%/%cached%.
|
|
10
|
+
rem Linear goto flow keeps every expansion on its own line, and avoids
|
|
11
|
+
rem delayed expansion eating ! characters in user arguments.
|
|
12
|
+
rem - The unversioned user binary and the PATH candidate are validated with
|
|
13
|
+
rem the engine-probe handshake (see :probe) so the retired 3.x npm CLI,
|
|
14
|
+
rem whose bin is also named impeccable, is never exec'd. IMPECCABLE_BIN,
|
|
15
|
+
rem the sibling binary, and the version-pinned cache stay trusted.
|
|
16
|
+
rem - Downloads and the version-pinned cache are verified via certutil
|
|
17
|
+
rem against engine-checksums.txt next to this file, and fail closed; a
|
|
18
|
+
rem .verified stamp lets later runs skip hashing the cache. On ARM64 the
|
|
19
|
+
rem arm64 asset is tried first and the x64 asset is the fallback (Windows on
|
|
20
|
+
rem ARM runs x64 binaries), each only when the manifest has a line for it.
|
|
21
|
+
if not defined IMPECCABLE_SKILL_DIR set "IMPECCABLE_SKILL_DIR=%~dp0.."
|
|
22
|
+
if not defined IMPECCABLE_SELF set "IMPECCABLE_SELF=%~f0"
|
|
23
|
+
set "arch=x64"
|
|
24
|
+
if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "arch=arm64"
|
|
25
|
+
|
|
26
|
+
if not defined IMPECCABLE_BIN goto no_env_bin
|
|
27
|
+
if not exist "%IMPECCABLE_BIN%" goto no_env_bin
|
|
28
|
+
set "run=%IMPECCABLE_BIN%"
|
|
29
|
+
goto run
|
|
30
|
+
:no_env_bin
|
|
31
|
+
|
|
32
|
+
set "bin=%~dp0bin\windows-%arch%\impeccable.exe"
|
|
33
|
+
if not exist "%bin%" goto no_sibling
|
|
34
|
+
set "run=%bin%"
|
|
35
|
+
goto run
|
|
36
|
+
:no_sibling
|
|
37
|
+
|
|
38
|
+
set "home_bin=%USERPROFILE%\.impeccable\bin\impeccable.exe"
|
|
39
|
+
if not exist "%home_bin%" goto no_home_bin
|
|
40
|
+
if defined IMPECCABLE_LAUNCHER_PROBE goto no_home_bin
|
|
41
|
+
call :probe "%home_bin%"
|
|
42
|
+
if not "%probe_ok%"=="1" goto no_home_bin
|
|
43
|
+
set "run=%home_bin%"
|
|
44
|
+
goto run
|
|
45
|
+
:no_home_bin
|
|
46
|
+
|
|
47
|
+
set "version="
|
|
48
|
+
if exist "%~dp0VERSION" set /p version=<"%~dp0VERSION"
|
|
49
|
+
if not defined IMPECCABLE_HOME set "IMPECCABLE_HOME=%USERPROFILE%\.impeccable"
|
|
50
|
+
set "cached=%IMPECCABLE_HOME%\bin\%version%\impeccable.exe"
|
|
51
|
+
set "asset=impeccable-windows-%arch%.exe"
|
|
52
|
+
set "manifest=%~dp0engine-checksums.txt"
|
|
53
|
+
if not defined version goto no_cache
|
|
54
|
+
if not exist "%cached%" goto no_cache
|
|
55
|
+
if exist "%cached%.verified" goto cache_trusted
|
|
56
|
+
call :read_expected
|
|
57
|
+
call :sha256 "%cached%" "%TEMP%\impeccable-hash-%RANDOM%%RANDOM%.txt"
|
|
58
|
+
if not defined actual goto cache_unverified
|
|
59
|
+
if /I "%actual%"=="%expected%" goto cache_verified
|
|
60
|
+
if /I "%actual%"=="%expected_x64%" goto cache_verified
|
|
61
|
+
:cache_unverified
|
|
62
|
+
echo impeccable: cannot verify the cached engine "%cached%" against "%manifest%"; not using it 1>&2
|
|
63
|
+
goto no_cache
|
|
64
|
+
:cache_verified
|
|
65
|
+
(>"%cached%.verified" echo %actual%) 2>nul
|
|
66
|
+
:cache_trusted
|
|
67
|
+
set "run=%cached%"
|
|
68
|
+
goto run
|
|
69
|
+
:no_cache
|
|
70
|
+
|
|
71
|
+
if defined IMPECCABLE_LAUNCHER_PROBE goto download
|
|
72
|
+
where impeccable >nul 2>nul
|
|
73
|
+
if errorlevel 1 goto download
|
|
74
|
+
call :probe impeccable
|
|
75
|
+
if not "%probe_ok%"=="1" goto download
|
|
76
|
+
impeccable %*
|
|
77
|
+
exit /b %errorlevel%
|
|
78
|
+
|
|
79
|
+
:download
|
|
80
|
+
rem Last resort: fetch this version's binary from the release channel into
|
|
81
|
+
rem the version-pinned user cache, verify it, then run it. Never inside
|
|
82
|
+
rem another launcher's probe: fail fast and quiet instead.
|
|
83
|
+
if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
|
|
84
|
+
if not defined version goto fail
|
|
85
|
+
call :read_expected
|
|
86
|
+
if not defined expected if not defined expected_x64 goto no_checksum
|
|
87
|
+
where curl.exe >nul 2>nul
|
|
88
|
+
if errorlevel 1 goto curl_missing
|
|
89
|
+
if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
|
|
90
|
+
if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
|
|
91
|
+
mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
|
|
92
|
+
if errorlevel 1 goto cache_directory_failed
|
|
93
|
+
:cache_ready
|
|
94
|
+
rem Stage the download in a directory only this run owns, as the sh launcher
|
|
95
|
+
rem does with .impeccable.part.$$: concurrent first runs (parallel hooks, two
|
|
96
|
+
rem agents) must never write, hash or move each other's files. mkdir fails
|
|
97
|
+
rem when the name exists, so it claims the name atomically. RANDOM alone is
|
|
98
|
+
rem not enough because cmd seeds it from the clock in whole seconds; the
|
|
99
|
+
rem timestamp and the retry on collision keep same-second runs apart. A cache
|
|
100
|
+
rem directory that refuses every mkdir is reported as unwritable.
|
|
101
|
+
set "attempt=0"
|
|
102
|
+
:claim_staging
|
|
103
|
+
set /a attempt+=1
|
|
104
|
+
if %attempt% GTR 20 goto cache_write_failed
|
|
105
|
+
set "stamp=%TIME: =0%"
|
|
106
|
+
set "stamp=%stamp::=%"
|
|
107
|
+
set "stamp=%stamp:.=%"
|
|
108
|
+
set "stamp=%stamp:,=%"
|
|
109
|
+
set "staging=%IMPECCABLE_HOME%\bin\%version%\.impeccable.part.%stamp%-%RANDOM%%RANDOM%"
|
|
110
|
+
mkdir "%staging%" >nul 2>nul
|
|
111
|
+
if errorlevel 1 goto claim_staging
|
|
112
|
+
set "part=%staging%\impeccable.exe"
|
|
113
|
+
rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
|
|
114
|
+
rem branch on the command's failure directly.
|
|
115
|
+
(type nul >"%part%") 2>nul || goto staging_write_failed
|
|
116
|
+
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
|
117
|
+
if not defined expected goto fetch_x64
|
|
118
|
+
curl.exe -fsSL -o "%part%" "%url%" >nul 2>nul
|
|
119
|
+
if not errorlevel 1 goto verify
|
|
120
|
+
:fetch_x64
|
|
121
|
+
if not defined expected_x64 goto download_failed
|
|
122
|
+
set "asset=impeccable-windows-x64.exe"
|
|
123
|
+
set "expected=%expected_x64%"
|
|
124
|
+
set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
|
|
125
|
+
curl.exe -fsSL -o "%part%" "%url%" >nul 2>nul
|
|
126
|
+
if errorlevel 1 goto download_failed
|
|
127
|
+
|
|
128
|
+
:verify
|
|
129
|
+
call :check_download
|
|
130
|
+
if errorlevel 1 exit /b 127
|
|
131
|
+
rem Mirrors the sh launcher and fails closed: a freshly downloaded binary
|
|
132
|
+
rem runs only after its hash matches the digest read from engine-checksums.txt.
|
|
133
|
+
rem An empty certutil result refuses the download instead of running an
|
|
134
|
+
rem unverified binary.
|
|
135
|
+
call :sha256 "%part%" "%staging%\hash.txt"
|
|
136
|
+
call :check_download
|
|
137
|
+
if errorlevel 1 exit /b 127
|
|
138
|
+
if not defined actual goto verify_refuse
|
|
139
|
+
if /I "%actual%"=="%expected%" goto place
|
|
140
|
+
call :discard_staging
|
|
141
|
+
echo impeccable: checksum mismatch downloading %url% 1>&2
|
|
142
|
+
exit /b 127
|
|
143
|
+
|
|
144
|
+
:verify_refuse
|
|
145
|
+
call :check_download
|
|
146
|
+
if errorlevel 1 exit /b 127
|
|
147
|
+
call :discard_staging
|
|
148
|
+
echo impeccable: cannot verify %url% (certutil could not hash it); refusing the unverified download 1>&2
|
|
149
|
+
exit /b 127
|
|
150
|
+
|
|
151
|
+
:read_expected
|
|
152
|
+
rem Sets expected (and, on ARM64, expected_x64: Windows on ARM runs x64
|
|
153
|
+
rem binaries) from engine-checksums.txt. Only called off the stamped path:
|
|
154
|
+
rem hooks run this launcher on every edit.
|
|
155
|
+
call :manifest_digest "%asset%" expected
|
|
156
|
+
set "expected_x64="
|
|
157
|
+
if "%arch%"=="arm64" call :manifest_digest impeccable-windows-x64.exe expected_x64
|
|
158
|
+
exit /b 0
|
|
159
|
+
|
|
160
|
+
:manifest_digest
|
|
161
|
+
rem Sets the variable named %2 to the digest the first engine-checksums.txt
|
|
162
|
+
rem line for this version and asset %1 records, empty when there is none.
|
|
163
|
+
set "%~2="
|
|
164
|
+
if not exist "%manifest%" exit /b 0
|
|
165
|
+
for /f "usebackq tokens=1-3" %%a in ("%manifest%") do if "%%a"=="%version%" if /I "%%b"=="%~1" if not defined %~2 set "%~2=%%c"
|
|
166
|
+
exit /b 0
|
|
167
|
+
|
|
168
|
+
:sha256
|
|
169
|
+
rem Sets actual to the sha256 of %~1, empty when certutil fails. %~2 is the
|
|
170
|
+
rem scratch file for its output. Check certutil's status before parsing: its
|
|
171
|
+
rem error text on stdout is not a digest.
|
|
172
|
+
set "actual="
|
|
173
|
+
certutil -hashfile "%~1" SHA256 >"%~2" 2>nul
|
|
174
|
+
if errorlevel 1 goto sha256_done
|
|
175
|
+
for /f "usebackq skip=1 delims=" %%h in ("%~2") do if not defined actual set "actual=%%h"
|
|
176
|
+
if not defined actual goto sha256_done
|
|
177
|
+
set "actual=%actual: =%"
|
|
178
|
+
:sha256_done
|
|
179
|
+
del "%~2" >nul 2>nul
|
|
180
|
+
exit /b 0
|
|
181
|
+
|
|
182
|
+
:check_download
|
|
183
|
+
set "download_file=%~1"
|
|
184
|
+
if not defined download_file set "download_file=%part%"
|
|
185
|
+
if not exist "%download_file%" goto download_missing
|
|
186
|
+
for %%f in ("%download_file%") do if %%~zf==0 goto download_empty
|
|
187
|
+
exit /b 0
|
|
188
|
+
|
|
189
|
+
:download_missing
|
|
190
|
+
call :discard_staging
|
|
191
|
+
echo impeccable: download completed but the file was removed before execution: %url%; check your antivirus quarantine or logs. Refusing to continue; do not disable protection. 1>&2
|
|
192
|
+
exit /b 127
|
|
193
|
+
|
|
194
|
+
:download_empty
|
|
195
|
+
del "%download_file%" >nul 2>nul
|
|
196
|
+
call :discard_staging
|
|
197
|
+
echo impeccable: downloaded file is empty: %url%; refusing the unverified download 1>&2
|
|
198
|
+
exit /b 127
|
|
199
|
+
|
|
200
|
+
:discard_staging
|
|
201
|
+
rem Removes this run's staging directory and whatever is left in it. Never
|
|
202
|
+
rem touches another run's staging directory or the cached binary.
|
|
203
|
+
if defined staging rd /s /q "%staging%" >nul 2>nul
|
|
204
|
+
exit /b 0
|
|
205
|
+
|
|
206
|
+
:place
|
|
207
|
+
call :check_download
|
|
208
|
+
if errorlevel 1 exit /b 127
|
|
209
|
+
move /y "%part%" "%cached%" >nul 2>nul
|
|
210
|
+
if errorlevel 1 goto place_failed
|
|
211
|
+
call :discard_staging
|
|
212
|
+
call :check_download "%cached%"
|
|
213
|
+
if errorlevel 1 exit /b 127
|
|
214
|
+
(>"%cached%.verified" echo %actual%) 2>nul
|
|
215
|
+
set "run=%cached%"
|
|
216
|
+
goto run
|
|
217
|
+
|
|
218
|
+
:place_failed
|
|
219
|
+
call :check_download
|
|
220
|
+
if errorlevel 1 exit /b 127
|
|
221
|
+
call :discard_staging
|
|
222
|
+
echo impeccable: could not cache the verified download: %url% 1>&2
|
|
223
|
+
exit /b 127
|
|
224
|
+
|
|
225
|
+
:run
|
|
226
|
+
"%run%" %*
|
|
227
|
+
exit /b %errorlevel%
|
|
228
|
+
|
|
229
|
+
:probe
|
|
230
|
+
rem Sets probe_ok=1 when %1 answers the engine handshake: prints
|
|
231
|
+
rem "impeccable-engine <version>" and exits 0. The 3.x npm CLI answers any
|
|
232
|
+
rem unknown verb with "Unknown command", exit 1, so it never passes.
|
|
233
|
+
set "probe_ok="
|
|
234
|
+
set "probe_tmp=%TEMP%\impeccable-probe-%RANDOM%%RANDOM%.txt"
|
|
235
|
+
set "IMPECCABLE_LAUNCHER_PROBE=1"
|
|
236
|
+
"%~1" engine-probe >"%probe_tmp%" 2>nul
|
|
237
|
+
set "probe_err=%ERRORLEVEL%"
|
|
238
|
+
set "IMPECCABLE_LAUNCHER_PROBE="
|
|
239
|
+
if not "%probe_err%"=="0" goto probe_done
|
|
240
|
+
findstr /b /c:"impeccable-engine" "%probe_tmp%" >nul 2>nul
|
|
241
|
+
if not errorlevel 1 set "probe_ok=1"
|
|
242
|
+
:probe_done
|
|
243
|
+
del "%probe_tmp%" >nul 2>nul
|
|
244
|
+
exit /b 0
|
|
245
|
+
|
|
246
|
+
:no_checksum
|
|
247
|
+
echo impeccable: no checksum for engine %version% (%asset%) in "%manifest%"; refusing the unverified download 1>&2
|
|
248
|
+
exit /b 127
|
|
249
|
+
|
|
250
|
+
:cache_directory_failed
|
|
251
|
+
echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
|
252
|
+
goto setup_failed
|
|
253
|
+
|
|
254
|
+
:staging_write_failed
|
|
255
|
+
call :discard_staging
|
|
256
|
+
|
|
257
|
+
:cache_write_failed
|
|
258
|
+
echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
|
|
259
|
+
goto setup_failed
|
|
260
|
+
|
|
261
|
+
:curl_missing
|
|
262
|
+
echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
|
|
263
|
+
goto setup_failed
|
|
264
|
+
|
|
265
|
+
:download_failed
|
|
266
|
+
call :discard_staging
|
|
267
|
+
echo impeccable: could not download engine %version% from %url%; check network access and the release URL. 1>&2
|
|
268
|
+
|
|
269
|
+
:setup_failed
|
|
270
|
+
echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
|
|
271
|
+
echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
|
|
272
|
+
echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
|
|
273
|
+
exit /b 127
|
|
274
|
+
|
|
275
|
+
:fail
|
|
276
|
+
echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
|
|
277
|
+
echo Download impeccable-windows-%arch%.exe from https://github.com/pbakaus/impeccable/releases (tag engine-v%version%) and save it as %cached%, or set IMPECCABLE_BIN to a preinstalled engine binary. Docs: https://impeccable.style 1>&2
|
|
278
|
+
exit /b 127
|