wrxn-reversa 1.13.0 → 1.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.13.1
4
+
5
+ ### Packaging
6
+
7
+ - Repackaged the release from the exact Git commit.
8
+ - npm version `1.13.0` was published from the working tree.
9
+ Its only file difference from the verified source was CRLF line endings in `agents/impeccable/scripts/impeccable.cmd`; this package uses Git's LF bytes.
10
+
3
11
  ## 1.13.0
4
12
 
5
13
  ### Changes
@@ -1,383 +1,383 @@
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. The sibling binary
15
- rem must also report the version in VERSION: it is not tracked, so a skill
16
- rem upgrade can leave an old engine in place. The user binary outlives every
17
- rem skill upgrade, so it must report that version too. IMPECCABLE_BIN stays
18
- rem trusted.
19
- rem - Downloads and the version-pinned cache are verified via certutil
20
- rem against engine-checksums.txt next to this file, and fail closed; a
21
- rem .verified stamp lets later runs skip hashing the cache while it holds
22
- rem the manifest digest and the binary's size and is not older than the
23
- rem binary. On ARM64 the arm64 asset is tried first and the x64 asset is the
24
- rem fallback (Windows on ARM runs x64 binaries), each only when the manifest
25
- rem has a line for it.
26
- rem - Nothing is resolved from the working directory, which may be a project
27
- rem nobody has vetted (#1735). cmd looks there before PATH for every command
28
- rem run by name unless NoDefaultCurrentDirectoryInExePath is set, and so
29
- rem does where unless it is given $PATH. The engine runs without the
30
- rem variable when this launcher set it, so its own child shells behave as
31
- rem they did.
32
- set "cwd_guard="
33
- if not defined NoDefaultCurrentDirectoryInExePath set "cwd_guard=1"& set "NoDefaultCurrentDirectoryInExePath=1"
34
- if not defined IMPECCABLE_SKILL_DIR set "IMPECCABLE_SKILL_DIR=%~dp0.."
35
- if not defined IMPECCABLE_SELF set "IMPECCABLE_SELF=%~f0"
36
- set "arch=x64"
37
- if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "arch=arm64"
38
-
39
- if not defined IMPECCABLE_BIN goto no_env_bin
40
- if not exist "%IMPECCABLE_BIN%" goto no_env_bin
41
- set "run=%IMPECCABLE_BIN%"
42
- goto run
43
- :no_env_bin
44
-
45
- set "version="
46
- if exist "%~dp0VERSION" set /p version=<"%~dp0VERSION"
47
- set "bin=%~dp0bin\windows-%arch%\impeccable.exe"
48
- if not exist "%bin%" goto no_sibling
49
- if defined IMPECCABLE_LAUNCHER_PROBE goto sibling_ok
50
- if not defined version goto sibling_ok
51
- call :probe "%bin%"
52
- if "%probe_version%"=="%version%" goto sibling_ok
53
- if not defined probe_version set "probe_version=unknown"
54
- echo impeccable: skipping "%bin%": it reports engine %probe_version% but this skill pins %version%; delete it to stop this warning 1>&2
55
- goto no_sibling
56
- :sibling_ok
57
- set "run=%bin%"
58
- goto run
59
- :no_sibling
60
-
61
- set "home_bin=%USERPROFILE%\.impeccable\bin\impeccable.exe"
62
- if not exist "%home_bin%" goto no_home_bin
63
- if defined IMPECCABLE_LAUNCHER_PROBE goto no_home_bin
64
- call :probe "%home_bin%"
65
- if not "%probe_ok%"=="1" goto home_bin_stale
66
- if not defined version goto home_bin_ok
67
- if "%probe_version%"=="%version%" goto home_bin_ok
68
- :home_bin_stale
69
- if not defined version goto no_home_bin
70
- if not defined probe_version set "probe_version=unknown"
71
- echo impeccable: skipping "%home_bin%": it reports engine %probe_version% but this skill pins %version%; delete it to stop this warning 1>&2
72
- goto no_home_bin
73
- :home_bin_ok
74
- set "run=%home_bin%"
75
- goto run
76
- :no_home_bin
77
-
78
- if not defined IMPECCABLE_HOME set "IMPECCABLE_HOME=%USERPROFILE%\.impeccable"
79
- set "cached=%IMPECCABLE_HOME%\bin\%version%\impeccable.exe"
80
- set "asset=impeccable-windows-%arch%.exe"
81
- set "manifest=%~dp0engine-checksums.txt"
82
- if not defined version goto no_cache
83
- if not exist "%cached%" goto no_cache
84
- call :read_expected
85
- for %%f in ("%cached%") do set "size=%%~zf"
86
- set "stamp="
87
- if exist "%cached%.verified" for /f "usebackq tokens=1,2" %%s in ("%cached%.verified") do set "stamp=%%s"& set "stamp_size=%%t"
88
- if not defined stamp goto cache_hash
89
- if not "%stamp_size%"=="%size%" goto cache_hash
90
- if /I "%stamp%"=="%expected%" goto cache_stamp_matches
91
- if /I "%stamp%"=="%expected_x64%" goto cache_stamp_matches
92
- goto cache_hash
93
- :cache_stamp_matches
94
- rem Newest first: the stamp must be listed before the binary it vouches for.
95
- set "newest="
96
- for /f "delims=" %%f in ('dir /b /a:-d /o:-d "%cached%*" 2^>nul') do if not defined newest set "newest=%%f"
97
- if /I "%newest%"=="impeccable.exe.verified" goto cache_trusted
98
- :cache_hash
99
- call :sha256 "%cached%" "%TEMP%\impeccable-hash-%RANDOM%%RANDOM%.txt"
100
- if not defined actual goto cache_unverified
101
- if /I "%actual%"=="%expected%" goto cache_verified
102
- if /I "%actual%"=="%expected_x64%" goto cache_verified
103
- :cache_unverified
104
- echo impeccable: cannot verify the cached engine "%cached%" against "%manifest%"; not using it 1>&2
105
- goto no_cache
106
- :cache_verified
107
- (>"%cached%.verified" echo %actual% %size%) 2>nul
108
- :cache_trusted
109
- set "run=%cached%"
110
- goto run
111
- :no_cache
112
-
113
- if defined IMPECCABLE_LAUNCHER_PROBE goto download
114
- rem The first impeccable on PATH, resolved once so the probe and the run see
115
- rem the same file. A batch shim (npm writes impeccable.cmd) must run under
116
- rem call to return here (#1240), and call expands % in the arguments a second
117
- rem time; a real binary runs directly so a target such as a%20b reaches it intact.
118
- set "path_bin="
119
- rem where also lists npm's extensionless POSIX shim, which cmd cannot run:
120
- rem take the first match with a runnable extension.
121
- rem Loop letters c and k are not path modifiers, so %%~xc reads as the
122
- rem extension of c and never as a loop variable followed by text.
123
- for /f "delims=" %%c in ('where $PATH:impeccable 2^>nul') do if not defined path_bin for %%k in (.exe .com .cmd .bat) do if /I "%%~xc"=="%%k" set "path_bin=%%c"
124
- if not defined path_bin goto download
125
- call :probe "%path_bin%"
126
- if not "%probe_ok%"=="1" goto download
127
- if defined cwd_guard set "NoDefaultCurrentDirectoryInExePath="
128
- for %%k in ("%path_bin%") do set "path_ext=%%~xk"
129
- if /I "%path_ext%"==".cmd" goto path_shim
130
- if /I "%path_ext%"==".bat" goto path_shim
131
- "%path_bin%" %*
132
- exit /b %errorlevel%
133
- :path_shim
134
- call "%path_bin%" %*
135
- exit /b %errorlevel%
136
-
137
- :download
138
- rem Last resort: fetch this version's binary from the release channel into
139
- rem the version-pinned user cache, verify it, then run it. Never inside
140
- rem another launcher's probe: fail fast and quiet instead.
141
- if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
142
- if not defined version goto fail
143
- call :read_expected
144
- if not defined expected if not defined expected_x64 goto no_checksum
145
- where $PATH:curl.exe >nul 2>nul
146
- if errorlevel 1 goto curl_missing
147
- if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
148
- if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
149
- mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
150
- if errorlevel 1 goto cache_directory_failed
151
- :cache_ready
152
- rem Remove staging directories killed runs left in any version's cache, once
153
- rem two days idle (forfiles /d counts days; a live curl's open file stays).
154
- forfiles /p "%IMPECCABLE_HOME%\bin" /s /m .impeccable.part.* /d -2 /c "cmd /c if @isdir==TRUE rd /s /q @path" >nul 2>nul
155
- rem Stage the download in a directory only this run owns, as the sh launcher
156
- rem does with .impeccable.part.$$: concurrent first runs (parallel hooks, two
157
- rem agents) must never write, hash or move each other's files. mkdir fails
158
- rem when the name exists, so it claims the name atomically. RANDOM alone is
159
- rem not enough because cmd seeds it from the clock in whole seconds; the
160
- rem timestamp and the retry on collision keep same-second runs apart. A cache
161
- rem directory that refuses every mkdir is reported as unwritable.
162
- set "attempt=0"
163
- :claim_staging
164
- set /a attempt+=1
165
- if %attempt% GTR 20 goto cache_write_failed
166
- set "stamp=%TIME: =0%"
167
- set "stamp=%stamp::=%"
168
- set "stamp=%stamp:.=%"
169
- set "stamp=%stamp:,=%"
170
- set "staging=%IMPECCABLE_HOME%\bin\%version%\.impeccable.part.%stamp%-%RANDOM%%RANDOM%"
171
- mkdir "%staging%" >nul 2>nul
172
- if errorlevel 1 goto claim_staging
173
- set "part=%staging%\impeccable.exe"
174
- rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
175
- rem branch on the command's failure directly.
176
- (type nul >"%part%") 2>nul || goto staging_write_failed
177
- set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
178
- if not defined expected goto fetch_x64
179
- call :fetch_url
180
- if not errorlevel 1 goto verify
181
- :fetch_x64
182
- if not defined expected_x64 goto download_failed
183
- set "asset=impeccable-windows-x64.exe"
184
- set "expected=%expected_x64%"
185
- set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
186
- call :fetch_url
187
- if errorlevel 1 goto download_failed
188
-
189
- :verify
190
- call :check_download
191
- if errorlevel 1 exit /b 127
192
- rem Mirrors the sh launcher and fails closed: a freshly downloaded binary
193
- rem runs only after its hash matches the digest read from engine-checksums.txt.
194
- rem An empty certutil result refuses the download instead of running an
195
- rem unverified binary.
196
- call :sha256 "%part%" "%staging%\hash.txt"
197
- call :check_download
198
- if errorlevel 1 exit /b 127
199
- if not defined actual goto verify_refuse
200
- if /I "%actual%"=="%expected%" goto place
201
- call :discard_staging
202
- echo impeccable: checksum mismatch downloading %url% 1>&2
203
- exit /b 127
204
-
205
- :verify_refuse
206
- call :check_download
207
- if errorlevel 1 exit /b 127
208
- call :discard_staging
209
- echo impeccable: cannot verify %url% (certutil could not hash it); refusing the unverified download 1>&2
210
- exit /b 127
211
-
212
- :fetch_url
213
- set "http_status="
214
- set "effective_url="
215
- set "download_host="
216
- set "curl_error="
217
- curl.exe -fsSL --retry 2 -w "%%{http_code} %%{url_effective} %%{errormsg}" -o "%part%" "%url%" >"%staging%\http.txt" 2>nul
218
- set "fetch_result=%errorlevel%"
219
- for /f "usebackq tokens=1" %%a in ("%staging%\http.txt") do set "http_status=%%a"
220
- for /f "usebackq tokens=2" %%a in ("%staging%\http.txt") do set "effective_url=%%a"
221
- for /f "usebackq tokens=2,*" %%a in ("%staging%\http.txt") do set "curl_error=%%b"
222
- rem Token 2 is the authority after scheme://. Drop userinfo and the port.
223
- for /f "tokens=2 delims=/" %%h in ("%effective_url%") do set "download_host=%%h"
224
- for /f "tokens=1,* delims=@" %%h in ("%download_host%") do if not "%%i"=="" set "download_host=%%i"
225
- rem Bracketed IPv6 hosts contain colons that are not port separators.
226
- if "%download_host:~0,1%"=="[" goto fetch_ipv6
227
- for /f "tokens=1 delims=:" %%h in ("%download_host%") do set "download_host=%%h"
228
- exit /b %fetch_result%
229
- :fetch_ipv6
230
- for /f "tokens=1 delims=]" %%h in ("%download_host%") do set "download_host=%%h]"
231
- exit /b %fetch_result%
232
-
233
- :read_expected
234
- rem Sets expected (and, on ARM64, expected_x64: Windows on ARM runs x64
235
- rem binaries) from engine-checksums.txt.
236
- call :manifest_digest "%asset%" expected
237
- set "expected_x64="
238
- if "%arch%"=="arm64" call :manifest_digest impeccable-windows-x64.exe expected_x64
239
- exit /b 0
240
-
241
- :manifest_digest
242
- rem Sets the variable named %2 to the digest the first engine-checksums.txt
243
- rem line for this version and asset %1 records, empty when there is none.
244
- set "%~2="
245
- if not exist "%manifest%" exit /b 0
246
- for /f "usebackq tokens=1-3" %%a in ("%manifest%") do if "%%a"=="%version%" if /I "%%b"=="%~1" if not defined %~2 set "%~2=%%c"
247
- exit /b 0
248
-
249
- :sha256
250
- rem Sets actual to the sha256 of %~1, empty when certutil fails. %~2 is the
251
- rem scratch file for its output. Check certutil's status before parsing: its
252
- rem error text on stdout is not a digest.
253
- set "actual="
254
- certutil -hashfile "%~1" SHA256 >"%~2" 2>nul
255
- if errorlevel 1 goto sha256_done
256
- for /f "usebackq skip=1 delims=" %%h in ("%~2") do if not defined actual set "actual=%%h"
257
- if not defined actual goto sha256_done
258
- set "actual=%actual: =%"
259
- :sha256_done
260
- del "%~2" >nul 2>nul
261
- exit /b 0
262
-
263
- :check_download
264
- set "download_file=%~1"
265
- if not defined download_file set "download_file=%part%"
266
- if not exist "%download_file%" goto download_missing
267
- for %%f in ("%download_file%") do if %%~zf==0 goto download_empty
268
- exit /b 0
269
-
270
- :download_missing
271
- call :discard_staging
272
- 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
273
- exit /b 127
274
-
275
- :download_empty
276
- del "%download_file%" >nul 2>nul
277
- call :discard_staging
278
- echo impeccable: downloaded file is empty: %url%; refusing the unverified download 1>&2
279
- exit /b 127
280
-
281
- :discard_staging
282
- rem Removes this run's staging directory and whatever is left in it. Never
283
- rem touches another run's staging directory or the cached binary.
284
- if defined staging rd /s /q "%staging%" >nul 2>nul
285
- exit /b 0
286
-
287
- :place
288
- call :check_download
289
- if errorlevel 1 exit /b 127
290
- move /y "%part%" "%cached%" >nul 2>nul
291
- if errorlevel 1 goto place_failed
292
- call :discard_staging
293
- call :check_download "%cached%"
294
- if errorlevel 1 exit /b 127
295
- for %%f in ("%cached%") do set "size=%%~zf"
296
- (>"%cached%.verified" echo %actual% %size%) 2>nul
297
- set "run=%cached%"
298
- goto run
299
-
300
- :place_failed
301
- call :check_download
302
- if errorlevel 1 exit /b 127
303
- call :discard_staging
304
- echo impeccable: could not cache the verified download: %url% 1>&2
305
- exit /b 127
306
-
307
- :run
308
- if defined cwd_guard set "NoDefaultCurrentDirectoryInExePath="
309
- "%run%" %*
310
- exit /b %errorlevel%
311
-
312
- :probe
313
- rem Sets probe_ok=1 when %1 answers the engine handshake: prints
314
- rem "impeccable-engine <version>" and exits 0, and probe_version to that
315
- rem version. The 3.x npm CLI answers any unknown verb with "Unknown command",
316
- rem exit 1, so it never passes.
317
- rem The candidate runs under call: an npm .cmd shim run without it takes
318
- rem over this script and never returns (#1240).
319
- set "probe_ok="
320
- set "probe_version="
321
- set "probe_tmp=%TEMP%\impeccable-probe-%RANDOM%%RANDOM%.txt"
322
- set "IMPECCABLE_LAUNCHER_PROBE=1"
323
- call "%~1" engine-probe >"%probe_tmp%" 2>nul
324
- set "probe_err=%ERRORLEVEL%"
325
- set "IMPECCABLE_LAUNCHER_PROBE="
326
- if not "%probe_err%"=="0" goto probe_done
327
- findstr /b /c:"impeccable-engine" "%probe_tmp%" >nul 2>nul
328
- if errorlevel 1 goto probe_done
329
- set "probe_ok=1"
330
- for /f "usebackq tokens=2" %%v in ("%probe_tmp%") do if not defined probe_version set "probe_version=%%v"
331
- :probe_done
332
- del "%probe_tmp%" >nul 2>nul
333
- exit /b 0
334
-
335
- :no_checksum
336
- echo impeccable: no checksum for engine %version% (%asset%) in "%manifest%"; refusing the unverified download 1>&2
337
- exit /b 127
338
-
339
- :cache_directory_failed
340
- echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
341
- goto setup_failed
342
-
343
- :staging_write_failed
344
- call :discard_staging
345
-
346
- :cache_write_failed
347
- echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
348
- goto setup_failed
349
-
350
- :curl_missing
351
- echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
352
- goto setup_failed
353
-
354
- :download_failed
355
- call :discard_staging
356
- if not "%http_status:~0,1%"=="5" goto download_generic
357
- if "%http_status:~2,1%"=="" goto download_generic
358
- if /I "%download_host%"=="github.com" goto download_github
359
- if /I "%download_host:~-11%"==".github.com" goto download_github
360
- if /I "%download_host%"=="githubusercontent.com" goto download_github
361
- if /I "%download_host:~-22%"==".githubusercontent.com" goto download_github
362
- echo impeccable: could not download engine %version%: %download_host% is failing right now (HTTP %http_status%), a server error on %download_host%'s side. Try again later. 1>&2
363
- exit /b 127
364
- :download_github
365
- echo impeccable: could not download engine %version%: GitHub's downloads are failing right now (HTTP %http_status% from %download_host%). This is an outage on GitHub's side, not a problem with your setup or the CLI, so updating won't help. Check https://www.githubstatus.com and run the same command again once GitHub has recovered. 1>&2
366
- exit /b 127
367
- :download_generic
368
- rem Delayed expansion keeps cmd metacharacters in curl's message literal.
369
- setlocal EnableDelayedExpansion
370
- if defined curl_error set "curl_error=: !curl_error!"
371
- echo impeccable: could not download engine %version% from !url! (curl exit %fetch_result%!curl_error!); check network access and the release URL. 1>&2
372
- endlocal
373
-
374
- :setup_failed
375
- echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
376
- echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
377
- echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
378
- exit /b 127
379
-
380
- :fail
381
- echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
382
- 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
383
- 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. The sibling binary
15
+ rem must also report the version in VERSION: it is not tracked, so a skill
16
+ rem upgrade can leave an old engine in place. The user binary outlives every
17
+ rem skill upgrade, so it must report that version too. IMPECCABLE_BIN stays
18
+ rem trusted.
19
+ rem - Downloads and the version-pinned cache are verified via certutil
20
+ rem against engine-checksums.txt next to this file, and fail closed; a
21
+ rem .verified stamp lets later runs skip hashing the cache while it holds
22
+ rem the manifest digest and the binary's size and is not older than the
23
+ rem binary. On ARM64 the arm64 asset is tried first and the x64 asset is the
24
+ rem fallback (Windows on ARM runs x64 binaries), each only when the manifest
25
+ rem has a line for it.
26
+ rem - Nothing is resolved from the working directory, which may be a project
27
+ rem nobody has vetted (#1735). cmd looks there before PATH for every command
28
+ rem run by name unless NoDefaultCurrentDirectoryInExePath is set, and so
29
+ rem does where unless it is given $PATH. The engine runs without the
30
+ rem variable when this launcher set it, so its own child shells behave as
31
+ rem they did.
32
+ set "cwd_guard="
33
+ if not defined NoDefaultCurrentDirectoryInExePath set "cwd_guard=1"& set "NoDefaultCurrentDirectoryInExePath=1"
34
+ if not defined IMPECCABLE_SKILL_DIR set "IMPECCABLE_SKILL_DIR=%~dp0.."
35
+ if not defined IMPECCABLE_SELF set "IMPECCABLE_SELF=%~f0"
36
+ set "arch=x64"
37
+ if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "arch=arm64"
38
+
39
+ if not defined IMPECCABLE_BIN goto no_env_bin
40
+ if not exist "%IMPECCABLE_BIN%" goto no_env_bin
41
+ set "run=%IMPECCABLE_BIN%"
42
+ goto run
43
+ :no_env_bin
44
+
45
+ set "version="
46
+ if exist "%~dp0VERSION" set /p version=<"%~dp0VERSION"
47
+ set "bin=%~dp0bin\windows-%arch%\impeccable.exe"
48
+ if not exist "%bin%" goto no_sibling
49
+ if defined IMPECCABLE_LAUNCHER_PROBE goto sibling_ok
50
+ if not defined version goto sibling_ok
51
+ call :probe "%bin%"
52
+ if "%probe_version%"=="%version%" goto sibling_ok
53
+ if not defined probe_version set "probe_version=unknown"
54
+ echo impeccable: skipping "%bin%": it reports engine %probe_version% but this skill pins %version%; delete it to stop this warning 1>&2
55
+ goto no_sibling
56
+ :sibling_ok
57
+ set "run=%bin%"
58
+ goto run
59
+ :no_sibling
60
+
61
+ set "home_bin=%USERPROFILE%\.impeccable\bin\impeccable.exe"
62
+ if not exist "%home_bin%" goto no_home_bin
63
+ if defined IMPECCABLE_LAUNCHER_PROBE goto no_home_bin
64
+ call :probe "%home_bin%"
65
+ if not "%probe_ok%"=="1" goto home_bin_stale
66
+ if not defined version goto home_bin_ok
67
+ if "%probe_version%"=="%version%" goto home_bin_ok
68
+ :home_bin_stale
69
+ if not defined version goto no_home_bin
70
+ if not defined probe_version set "probe_version=unknown"
71
+ echo impeccable: skipping "%home_bin%": it reports engine %probe_version% but this skill pins %version%; delete it to stop this warning 1>&2
72
+ goto no_home_bin
73
+ :home_bin_ok
74
+ set "run=%home_bin%"
75
+ goto run
76
+ :no_home_bin
77
+
78
+ if not defined IMPECCABLE_HOME set "IMPECCABLE_HOME=%USERPROFILE%\.impeccable"
79
+ set "cached=%IMPECCABLE_HOME%\bin\%version%\impeccable.exe"
80
+ set "asset=impeccable-windows-%arch%.exe"
81
+ set "manifest=%~dp0engine-checksums.txt"
82
+ if not defined version goto no_cache
83
+ if not exist "%cached%" goto no_cache
84
+ call :read_expected
85
+ for %%f in ("%cached%") do set "size=%%~zf"
86
+ set "stamp="
87
+ if exist "%cached%.verified" for /f "usebackq tokens=1,2" %%s in ("%cached%.verified") do set "stamp=%%s"& set "stamp_size=%%t"
88
+ if not defined stamp goto cache_hash
89
+ if not "%stamp_size%"=="%size%" goto cache_hash
90
+ if /I "%stamp%"=="%expected%" goto cache_stamp_matches
91
+ if /I "%stamp%"=="%expected_x64%" goto cache_stamp_matches
92
+ goto cache_hash
93
+ :cache_stamp_matches
94
+ rem Newest first: the stamp must be listed before the binary it vouches for.
95
+ set "newest="
96
+ for /f "delims=" %%f in ('dir /b /a:-d /o:-d "%cached%*" 2^>nul') do if not defined newest set "newest=%%f"
97
+ if /I "%newest%"=="impeccable.exe.verified" goto cache_trusted
98
+ :cache_hash
99
+ call :sha256 "%cached%" "%TEMP%\impeccable-hash-%RANDOM%%RANDOM%.txt"
100
+ if not defined actual goto cache_unverified
101
+ if /I "%actual%"=="%expected%" goto cache_verified
102
+ if /I "%actual%"=="%expected_x64%" goto cache_verified
103
+ :cache_unverified
104
+ echo impeccable: cannot verify the cached engine "%cached%" against "%manifest%"; not using it 1>&2
105
+ goto no_cache
106
+ :cache_verified
107
+ (>"%cached%.verified" echo %actual% %size%) 2>nul
108
+ :cache_trusted
109
+ set "run=%cached%"
110
+ goto run
111
+ :no_cache
112
+
113
+ if defined IMPECCABLE_LAUNCHER_PROBE goto download
114
+ rem The first impeccable on PATH, resolved once so the probe and the run see
115
+ rem the same file. A batch shim (npm writes impeccable.cmd) must run under
116
+ rem call to return here (#1240), and call expands % in the arguments a second
117
+ rem time; a real binary runs directly so a target such as a%20b reaches it intact.
118
+ set "path_bin="
119
+ rem where also lists npm's extensionless POSIX shim, which cmd cannot run:
120
+ rem take the first match with a runnable extension.
121
+ rem Loop letters c and k are not path modifiers, so %%~xc reads as the
122
+ rem extension of c and never as a loop variable followed by text.
123
+ for /f "delims=" %%c in ('where $PATH:impeccable 2^>nul') do if not defined path_bin for %%k in (.exe .com .cmd .bat) do if /I "%%~xc"=="%%k" set "path_bin=%%c"
124
+ if not defined path_bin goto download
125
+ call :probe "%path_bin%"
126
+ if not "%probe_ok%"=="1" goto download
127
+ if defined cwd_guard set "NoDefaultCurrentDirectoryInExePath="
128
+ for %%k in ("%path_bin%") do set "path_ext=%%~xk"
129
+ if /I "%path_ext%"==".cmd" goto path_shim
130
+ if /I "%path_ext%"==".bat" goto path_shim
131
+ "%path_bin%" %*
132
+ exit /b %errorlevel%
133
+ :path_shim
134
+ call "%path_bin%" %*
135
+ exit /b %errorlevel%
136
+
137
+ :download
138
+ rem Last resort: fetch this version's binary from the release channel into
139
+ rem the version-pinned user cache, verify it, then run it. Never inside
140
+ rem another launcher's probe: fail fast and quiet instead.
141
+ if defined IMPECCABLE_LAUNCHER_PROBE exit /b 127
142
+ if not defined version goto fail
143
+ call :read_expected
144
+ if not defined expected if not defined expected_x64 goto no_checksum
145
+ where $PATH:curl.exe >nul 2>nul
146
+ if errorlevel 1 goto curl_missing
147
+ if not defined IMPECCABLE_DOWNLOAD_BASE set "IMPECCABLE_DOWNLOAD_BASE=https://github.com/pbakaus/impeccable/releases/download"
148
+ if exist "%IMPECCABLE_HOME%\bin\%version%\" goto cache_ready
149
+ mkdir "%IMPECCABLE_HOME%\bin\%version%" >nul 2>nul
150
+ if errorlevel 1 goto cache_directory_failed
151
+ :cache_ready
152
+ rem Remove staging directories killed runs left in any version's cache, once
153
+ rem two days idle (forfiles /d counts days; a live curl's open file stays).
154
+ forfiles /p "%IMPECCABLE_HOME%\bin" /s /m .impeccable.part.* /d -2 /c "cmd /c if @isdir==TRUE rd /s /q @path" >nul 2>nul
155
+ rem Stage the download in a directory only this run owns, as the sh launcher
156
+ rem does with .impeccable.part.$$: concurrent first runs (parallel hooks, two
157
+ rem agents) must never write, hash or move each other's files. mkdir fails
158
+ rem when the name exists, so it claims the name atomically. RANDOM alone is
159
+ rem not enough because cmd seeds it from the clock in whole seconds; the
160
+ rem timestamp and the retry on collision keep same-second runs apart. A cache
161
+ rem directory that refuses every mkdir is reported as unwritable.
162
+ set "attempt=0"
163
+ :claim_staging
164
+ set /a attempt+=1
165
+ if %attempt% GTR 20 goto cache_write_failed
166
+ set "stamp=%TIME: =0%"
167
+ set "stamp=%stamp::=%"
168
+ set "stamp=%stamp:.=%"
169
+ set "stamp=%stamp:,=%"
170
+ set "staging=%IMPECCABLE_HOME%\bin\%version%\.impeccable.part.%stamp%-%RANDOM%%RANDOM%"
171
+ mkdir "%staging%" >nul 2>nul
172
+ if errorlevel 1 goto claim_staging
173
+ set "part=%staging%\impeccable.exe"
174
+ rem Redirection failures do not reliably update ERRORLEVEL in cmd.exe;
175
+ rem branch on the command's failure directly.
176
+ (type nul >"%part%") 2>nul || goto staging_write_failed
177
+ set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
178
+ if not defined expected goto fetch_x64
179
+ call :fetch_url
180
+ if not errorlevel 1 goto verify
181
+ :fetch_x64
182
+ if not defined expected_x64 goto download_failed
183
+ set "asset=impeccable-windows-x64.exe"
184
+ set "expected=%expected_x64%"
185
+ set "url=%IMPECCABLE_DOWNLOAD_BASE%/engine-v%version%/%asset%"
186
+ call :fetch_url
187
+ if errorlevel 1 goto download_failed
188
+
189
+ :verify
190
+ call :check_download
191
+ if errorlevel 1 exit /b 127
192
+ rem Mirrors the sh launcher and fails closed: a freshly downloaded binary
193
+ rem runs only after its hash matches the digest read from engine-checksums.txt.
194
+ rem An empty certutil result refuses the download instead of running an
195
+ rem unverified binary.
196
+ call :sha256 "%part%" "%staging%\hash.txt"
197
+ call :check_download
198
+ if errorlevel 1 exit /b 127
199
+ if not defined actual goto verify_refuse
200
+ if /I "%actual%"=="%expected%" goto place
201
+ call :discard_staging
202
+ echo impeccable: checksum mismatch downloading %url% 1>&2
203
+ exit /b 127
204
+
205
+ :verify_refuse
206
+ call :check_download
207
+ if errorlevel 1 exit /b 127
208
+ call :discard_staging
209
+ echo impeccable: cannot verify %url% (certutil could not hash it); refusing the unverified download 1>&2
210
+ exit /b 127
211
+
212
+ :fetch_url
213
+ set "http_status="
214
+ set "effective_url="
215
+ set "download_host="
216
+ set "curl_error="
217
+ curl.exe -fsSL --retry 2 -w "%%{http_code} %%{url_effective} %%{errormsg}" -o "%part%" "%url%" >"%staging%\http.txt" 2>nul
218
+ set "fetch_result=%errorlevel%"
219
+ for /f "usebackq tokens=1" %%a in ("%staging%\http.txt") do set "http_status=%%a"
220
+ for /f "usebackq tokens=2" %%a in ("%staging%\http.txt") do set "effective_url=%%a"
221
+ for /f "usebackq tokens=2,*" %%a in ("%staging%\http.txt") do set "curl_error=%%b"
222
+ rem Token 2 is the authority after scheme://. Drop userinfo and the port.
223
+ for /f "tokens=2 delims=/" %%h in ("%effective_url%") do set "download_host=%%h"
224
+ for /f "tokens=1,* delims=@" %%h in ("%download_host%") do if not "%%i"=="" set "download_host=%%i"
225
+ rem Bracketed IPv6 hosts contain colons that are not port separators.
226
+ if "%download_host:~0,1%"=="[" goto fetch_ipv6
227
+ for /f "tokens=1 delims=:" %%h in ("%download_host%") do set "download_host=%%h"
228
+ exit /b %fetch_result%
229
+ :fetch_ipv6
230
+ for /f "tokens=1 delims=]" %%h in ("%download_host%") do set "download_host=%%h]"
231
+ exit /b %fetch_result%
232
+
233
+ :read_expected
234
+ rem Sets expected (and, on ARM64, expected_x64: Windows on ARM runs x64
235
+ rem binaries) from engine-checksums.txt.
236
+ call :manifest_digest "%asset%" expected
237
+ set "expected_x64="
238
+ if "%arch%"=="arm64" call :manifest_digest impeccable-windows-x64.exe expected_x64
239
+ exit /b 0
240
+
241
+ :manifest_digest
242
+ rem Sets the variable named %2 to the digest the first engine-checksums.txt
243
+ rem line for this version and asset %1 records, empty when there is none.
244
+ set "%~2="
245
+ if not exist "%manifest%" exit /b 0
246
+ for /f "usebackq tokens=1-3" %%a in ("%manifest%") do if "%%a"=="%version%" if /I "%%b"=="%~1" if not defined %~2 set "%~2=%%c"
247
+ exit /b 0
248
+
249
+ :sha256
250
+ rem Sets actual to the sha256 of %~1, empty when certutil fails. %~2 is the
251
+ rem scratch file for its output. Check certutil's status before parsing: its
252
+ rem error text on stdout is not a digest.
253
+ set "actual="
254
+ certutil -hashfile "%~1" SHA256 >"%~2" 2>nul
255
+ if errorlevel 1 goto sha256_done
256
+ for /f "usebackq skip=1 delims=" %%h in ("%~2") do if not defined actual set "actual=%%h"
257
+ if not defined actual goto sha256_done
258
+ set "actual=%actual: =%"
259
+ :sha256_done
260
+ del "%~2" >nul 2>nul
261
+ exit /b 0
262
+
263
+ :check_download
264
+ set "download_file=%~1"
265
+ if not defined download_file set "download_file=%part%"
266
+ if not exist "%download_file%" goto download_missing
267
+ for %%f in ("%download_file%") do if %%~zf==0 goto download_empty
268
+ exit /b 0
269
+
270
+ :download_missing
271
+ call :discard_staging
272
+ 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
273
+ exit /b 127
274
+
275
+ :download_empty
276
+ del "%download_file%" >nul 2>nul
277
+ call :discard_staging
278
+ echo impeccable: downloaded file is empty: %url%; refusing the unverified download 1>&2
279
+ exit /b 127
280
+
281
+ :discard_staging
282
+ rem Removes this run's staging directory and whatever is left in it. Never
283
+ rem touches another run's staging directory or the cached binary.
284
+ if defined staging rd /s /q "%staging%" >nul 2>nul
285
+ exit /b 0
286
+
287
+ :place
288
+ call :check_download
289
+ if errorlevel 1 exit /b 127
290
+ move /y "%part%" "%cached%" >nul 2>nul
291
+ if errorlevel 1 goto place_failed
292
+ call :discard_staging
293
+ call :check_download "%cached%"
294
+ if errorlevel 1 exit /b 127
295
+ for %%f in ("%cached%") do set "size=%%~zf"
296
+ (>"%cached%.verified" echo %actual% %size%) 2>nul
297
+ set "run=%cached%"
298
+ goto run
299
+
300
+ :place_failed
301
+ call :check_download
302
+ if errorlevel 1 exit /b 127
303
+ call :discard_staging
304
+ echo impeccable: could not cache the verified download: %url% 1>&2
305
+ exit /b 127
306
+
307
+ :run
308
+ if defined cwd_guard set "NoDefaultCurrentDirectoryInExePath="
309
+ "%run%" %*
310
+ exit /b %errorlevel%
311
+
312
+ :probe
313
+ rem Sets probe_ok=1 when %1 answers the engine handshake: prints
314
+ rem "impeccable-engine <version>" and exits 0, and probe_version to that
315
+ rem version. The 3.x npm CLI answers any unknown verb with "Unknown command",
316
+ rem exit 1, so it never passes.
317
+ rem The candidate runs under call: an npm .cmd shim run without it takes
318
+ rem over this script and never returns (#1240).
319
+ set "probe_ok="
320
+ set "probe_version="
321
+ set "probe_tmp=%TEMP%\impeccable-probe-%RANDOM%%RANDOM%.txt"
322
+ set "IMPECCABLE_LAUNCHER_PROBE=1"
323
+ call "%~1" engine-probe >"%probe_tmp%" 2>nul
324
+ set "probe_err=%ERRORLEVEL%"
325
+ set "IMPECCABLE_LAUNCHER_PROBE="
326
+ if not "%probe_err%"=="0" goto probe_done
327
+ findstr /b /c:"impeccable-engine" "%probe_tmp%" >nul 2>nul
328
+ if errorlevel 1 goto probe_done
329
+ set "probe_ok=1"
330
+ for /f "usebackq tokens=2" %%v in ("%probe_tmp%") do if not defined probe_version set "probe_version=%%v"
331
+ :probe_done
332
+ del "%probe_tmp%" >nul 2>nul
333
+ exit /b 0
334
+
335
+ :no_checksum
336
+ echo impeccable: no checksum for engine %version% (%asset%) in "%manifest%"; refusing the unverified download 1>&2
337
+ exit /b 127
338
+
339
+ :cache_directory_failed
340
+ echo impeccable: engine %version% is not installed; cannot create cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
341
+ goto setup_failed
342
+
343
+ :staging_write_failed
344
+ call :discard_staging
345
+
346
+ :cache_write_failed
347
+ echo impeccable: engine %version% is not installed; cannot write to cache directory: "%IMPECCABLE_HOME%\bin\%version%" 1>&2
348
+ goto setup_failed
349
+
350
+ :curl_missing
351
+ echo impeccable: cannot download engine %version%; curl.exe is unavailable. 1>&2
352
+ goto setup_failed
353
+
354
+ :download_failed
355
+ call :discard_staging
356
+ if not "%http_status:~0,1%"=="5" goto download_generic
357
+ if "%http_status:~2,1%"=="" goto download_generic
358
+ if /I "%download_host%"=="github.com" goto download_github
359
+ if /I "%download_host:~-11%"==".github.com" goto download_github
360
+ if /I "%download_host%"=="githubusercontent.com" goto download_github
361
+ if /I "%download_host:~-22%"==".githubusercontent.com" goto download_github
362
+ echo impeccable: could not download engine %version%: %download_host% is failing right now (HTTP %http_status%), a server error on %download_host%'s side. Try again later. 1>&2
363
+ exit /b 127
364
+ :download_github
365
+ echo impeccable: could not download engine %version%: GitHub's downloads are failing right now (HTTP %http_status% from %download_host%). This is an outage on GitHub's side, not a problem with your setup or the CLI, so updating won't help. Check https://www.githubstatus.com and run the same command again once GitHub has recovered. 1>&2
366
+ exit /b 127
367
+ :download_generic
368
+ rem Delayed expansion keeps cmd metacharacters in curl's message literal.
369
+ setlocal EnableDelayedExpansion
370
+ if defined curl_error set "curl_error=: !curl_error!"
371
+ echo impeccable: could not download engine %version% from !url! (curl exit %fetch_result%!curl_error!); check network access and the release URL. 1>&2
372
+ endlocal
373
+
374
+ :setup_failed
375
+ echo Engine %version% setup needs network access and write permission to "%IMPECCABLE_HOME%\bin\%version%". 1>&2
376
+ echo Run this launcher ("%~f0") with engine-probe in a terminal that has those permissions, then retry the original command. 1>&2
377
+ echo Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary. 1>&2
378
+ exit /b 127
379
+
380
+ :fail
381
+ echo impeccable: no engine binary found (looked in %bin%, %cached%, PATH). 1>&2
382
+ 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
383
+ exit /b 127
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrxn-reversa",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Transform legacy systems into executable specifications for AI coding agents",
5
5
  "bin": {
6
6
  "wrxn-reversa": "bin/reversa.js"