-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathstart.bat
More file actions
455 lines (423 loc) · 18 KB
/
Copy pathstart.bat
File metadata and controls
455 lines (423 loc) · 18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
title Marinara Engine
color 0A
echo.
echo +==========================================+
echo ^| Marinara Engine - Launcher ^|
echo +==========================================+
echo.
set "SKIP_UPDATE="
if /I "%~1"=="--skip-update" set "SKIP_UPDATE=1"
if /I "%~1"=="--no-update" set "SKIP_UPDATE=1"
:: Load launcher settings before the update decision. Server settings are reused below.
if not exist .env goto :early_env_done
for /f "usebackq eol=# tokens=1,* delims==" %%A in (".env") do (
if not "%%A"=="" if not "%%B"=="" set "%%A=%%~B"
)
:early_env_done
set "AUTO_UPDATE_DISABLED="
if /I "%AUTO_UPDATE_ENABLED%"=="0" set "AUTO_UPDATE_DISABLED=1"
if /I "%AUTO_UPDATE_ENABLED%"=="false" set "AUTO_UPDATE_DISABLED=1"
if /I "%AUTO_UPDATE_ENABLED%"=="no" set "AUTO_UPDATE_DISABLED=1"
if /I "%AUTO_UPDATE_ENABLED%"=="off" set "AUTO_UPDATE_DISABLED=1"
:: Check for Node.js
node --version >nul 2>&1
if errorlevel 1 (
echo [ERROR] Node.js is not installed or not in PATH.
echo Please install Node.js 24 LTS or newer from https://nodejs.org
echo.
pause
exit /b 1
)
for /f "tokens=1 delims=." %%a in ('node -v') do set "NODE_RAW=%%a"
set "NODE_MAJOR=!NODE_RAW:v=!"
if not defined NODE_MAJOR (
echo [ERROR] Could not determine Node.js version.
pause
exit /b 1
)
if !NODE_MAJOR! LSS 24 (
echo [ERROR] Node.js 24 LTS or newer is required. You have v!NODE_MAJOR!.
echo Please update Node.js from https://nodejs.org
echo.
pause
exit /b 1
)
:: Resolve the exact repo-pinned pnpm before any install path uses it.
call :resolve_pnpm_runner
if errorlevel 1 (
pause
exit /b 1
)
goto :after_restore_helper
:restore_stashed_changes
if not "!STASHED!"=="1" goto :eof
if "!STASH_REF!"=="" goto :eof
git stash apply -q "!STASH_REF!" >nul 2>&1
if errorlevel 1 (
echo [WARN] Auto-update could not reapply your local changes cleanly.
echo Your changes are preserved in !STASH_REF!.
echo Review them with: git stash show -p !STASH_REF!
echo Reapply them manually with: git stash pop !STASH_REF!
git reset --hard HEAD >nul 2>&1
goto :eof
)
git stash drop -q "!STASH_REF!" >nul 2>&1
goto :eof
:after_restore_helper
set "INSTALL_REQUIRED=0"
set "BUILD_REQUIRED=0"
set "DATA_SNAPSHOT_READY=0"
set "PNPM_RESOLUTION_FAILED=0"
:: Drop untracked leftovers in the source trees (e.g. files a failed Windows
:: checkout could not delete after a channel switch); they break tsc. This is
:: working-tree repair, not an update, so it runs even when auto-update is
:: disabled -- and before "stash push -u", which would otherwise capture the
:: stale file and restore it again after every update.
:: Not quiet: git prints "Removing <path>" only when it actually deletes
:: something, so a stray file of your own does not vanish without a trace.
set "CLEAN_FAILED=0"
if exist ".git" (
git clean -fd -- packages/shared/src packages/server/src packages/client/src 2>nul
if errorlevel 1 set "CLEAN_FAILED=1"
)
:: Auto-update from Git
if defined SKIP_UPDATE (
echo [OK] Skipping update check; starting the current local install.
goto :skip_update
)
if defined AUTO_UPDATE_DISABLED (
echo [OK] Automatic Engine updates disabled by AUTO_UPDATE_ENABLED=false.
node scripts\check-launcher-update.mjs
goto :skip_update
)
if not exist ".git" goto :skip_update
echo [..] Checking for updates...
for /f "tokens=*" %%i in ('git rev-parse HEAD 2^>nul') do set "OLD_HEAD=%%i"
set "CURRENT_BRANCH="
for /f "tokens=*" %%i in ('git branch --show-current 2^>nul') do set "CURRENT_BRANCH=%%i"
set "TARGET_BRANCH=main"
if /I "!CURRENT_BRANCH!"=="staging" set "TARGET_BRANCH=staging"
if "!CURRENT_BRANCH!"=="" (
git fetch origin "+refs/heads/main:refs/remotes/origin/main" "+refs/heads/staging:refs/remotes/origin/staging" --quiet >nul 2>&1
git merge-base --is-ancestor HEAD origin/staging >nul 2>&1
if not errorlevel 1 (
git merge-base --is-ancestor HEAD origin/main >nul 2>&1
if errorlevel 1 set "TARGET_BRANCH=staging"
)
)
set "TARGET_REF=origin/!TARGET_BRANCH!"
git fetch origin "+refs/heads/!TARGET_BRANCH!:refs/remotes/origin/!TARGET_BRANCH!" --quiet >nul 2>&1
if errorlevel 1 (
echo [WARN] Could not check for updates. Continuing with current version.
goto :skip_update
)
for /f "tokens=*" %%i in ('git rev-parse !TARGET_REF! 2^>nul') do set "TARGET_HEAD=%%i"
if /I "!OLD_HEAD!"=="!TARGET_HEAD!" (
echo [OK] Already up to date
goto :skip_update
)
:: Never auto-move onto a build whose storage format predates the data on
:: disk - it would silently show empty chat history (#4708). Checked BEFORE
:: the snapshot: a blocked target stays blocked on every launch, and
:: re-copying the whole data directory each time serves nothing. Exit 2 is a
:: real format block; any other failure means the check itself could not run.
:: Both skip the update (fail-safe) with distinguishable messages.
node scripts\protect-launcher-data.mjs check-target "!TARGET_HEAD!"
if errorlevel 2 (
echo [WARN] Skipping auto-update: the target version is older than your data format.
goto :skip_update
)
if errorlevel 1 (
echo [WARN] Skipping auto-update: could not verify the target's storage format.
goto :skip_update
)
node scripts\protect-launcher-data.mjs snapshot
if errorlevel 1 (
echo [WARN] Could not create an update snapshot. Skipping auto-update to protect your data.
goto :skip_update
)
set "DATA_SNAPSHOT_READY=1"
:: Drop known-safe untracked files that older installer versions placed in
:: $INSTDIR but are now also tracked in the repo. Without this, git merge
:: --ff-only refuses to overwrite them and the auto-update silently fails.
:: The repo copies are byte-identical to what the installer wrote, so this
:: is non-destructive — git restores them as tracked files after the merge.
if exist "app-icon.ico" (
git ls-files --error-unmatch "app-icon.ico" >nul 2>&1
if errorlevel 1 del /q "app-icon.ico" >nul 2>&1
)
:: Stash local changes, including untracked non-ignored files, so the update doesn't fail
set "STASHED=0"
set "STASH_REF="
set "DIRTY=0"
set "STASH_FAILED=0"
git diff --quiet >nul 2>&1
if errorlevel 1 set "DIRTY=1"
git diff --cached --quiet >nul 2>&1
if errorlevel 1 set "DIRTY=1"
set "UNTRACKED="
for /f "tokens=*" %%i in ('git ls-files --others --exclude-standard 2^>nul') do if not defined UNTRACKED set "UNTRACKED=1"
if defined UNTRACKED set "DIRTY=1"
:: A leftover we could not delete would be captured by "stash push -u" and
:: restored afterwards, making the broken tree permanent -- so a failed cleanup
:: blocks the stash and, with it, the update.
if "!CLEAN_FAILED!"=="1" (
echo [WARN] Could not clear stale files under packages\*\src.
set "STASH_FAILED=1"
) else if "!DIRTY!"=="1" (
git stash push -u -q -m "auto-stash before update" >nul 2>&1 && set "STASHED=1"
if not "!STASHED!"=="1" set "STASH_FAILED=1"
if "!STASHED!"=="1" for /f "tokens=*" %%i in ('git stash list -1 --format^=%%gd 2^>nul') do set "STASH_REF=%%i"
)
set "UPDATED_TO_TARGET=0"
set "ALLOW_DETACHED_FALLBACK=0"
if /I "!CURRENT_BRANCH!"=="main" set "ALLOW_DETACHED_FALLBACK=1"
if /I "!CURRENT_BRANCH!"=="master" set "ALLOW_DETACHED_FALLBACK=1"
if /I "!CURRENT_BRANCH!"=="staging" set "ALLOW_DETACHED_FALLBACK=1"
set "UPDATE_LOG=%TEMP%\marinara-update-!RANDOM!-!RANDOM!.log"
if exist "!UPDATE_LOG!" del /q "!UPDATE_LOG!" >nul 2>&1
if "!STASH_FAILED!"=="1" (
echo [WARN] Could not stash local changes. Skipping auto-update to avoid overwriting them.
) else (
if "!CURRENT_BRANCH!"=="" (
git checkout --detach "!TARGET_HEAD!" >"!UPDATE_LOG!" 2>&1 && set "UPDATED_TO_TARGET=1"
if not "!UPDATED_TO_TARGET!"=="1" git reset --hard "!TARGET_HEAD!" >"!UPDATE_LOG!" 2>&1 && set "UPDATED_TO_TARGET=1"
) else (
git merge --ff-only "!TARGET_REF!" >"!UPDATE_LOG!" 2>&1 && set "UPDATED_TO_TARGET=1"
if not "!UPDATED_TO_TARGET!"=="1" if "!ALLOW_DETACHED_FALLBACK!"=="1" (
echo [..] Fast-forward failed; resetting the installed checkout to the latest !TARGET_BRANCH! commit...
git reset --hard "!TARGET_HEAD!" >"!UPDATE_LOG!" 2>&1 && set "UPDATED_TO_TARGET=1"
)
)
)
if not "!UPDATED_TO_TARGET!"=="1" (
if "!STASH_FAILED!"=="1" (
if exist "!UPDATE_LOG!" del /q "!UPDATE_LOG!" >nul 2>&1
goto :skip_update
)
if "!STASHED!"=="1" call :restore_stashed_changes
echo [WARN] Could not update to !TARGET_REF!. Continuing with current version.
if exist "!UPDATE_LOG!" (
for %%A in ("!UPDATE_LOG!") do if %%~zA GTR 0 (
echo Git reported:
for /f "usebackq delims=" %%i in ("!UPDATE_LOG!") do echo %%i
)
del /q "!UPDATE_LOG!" >nul 2>&1
)
goto :skip_update
)
for /f "tokens=*" %%i in ('git rev-parse HEAD 2^>nul') do set "NEW_HEAD=%%i"
if /I not "!NEW_HEAD!"=="!TARGET_HEAD!" (
if "!STASHED!"=="1" call :restore_stashed_changes
echo [WARN] Update did not land on !TARGET_REF!. Continuing with current version.
if exist "!UPDATE_LOG!" del /q "!UPDATE_LOG!" >nul 2>&1
goto :skip_update
)
if "!STASHED!"=="1" call :restore_stashed_changes
if exist "!UPDATE_LOG!" del /q "!UPDATE_LOG!" >nul 2>&1
echo [OK] Updated to latest version
echo [..] Dependencies and build will be refreshed before startup.
call :resolve_pnpm_runner
if errorlevel 1 (
set "PNPM_RESOLUTION_FAILED=1"
) else (
set "INSTALL_REQUIRED=1"
set "BUILD_REQUIRED=1"
)
:skip_update
if "!DATA_SNAPSHOT_READY!"=="1" (
node scripts\protect-launcher-data.mjs restore-if-missing
if errorlevel 1 (
echo [ERROR] User data verification failed after the update attempt.
echo Startup stopped to avoid creating empty data.
pause
exit /b 1
)
)
if "!PNPM_RESOLUTION_FAILED!"=="1" (
pause
exit /b 1
)
echo [OK] Node.js found:
node -v
echo [OK] pnpm !CURRENT_PNPM_VERSION! ready
:: Detect stale dist (source updated but dist not rebuilt)
if not exist "packages\shared\dist\constants\defaults.js" goto :skip_version_check
for /f "usebackq delims=" %%i in (`node -p "require('./package.json').version" 2^>nul`) do set "SOURCE_VER=%%i"
for /f "usebackq delims=" %%i in (`node -e "try{const m=require('./packages/shared/dist/constants/defaults.js');console.log(m.APP_VERSION)}catch{}" 2^>nul`) do set "DIST_VER=%%i"
for /f "usebackq delims=" %%i in (`git rev-parse --short=12 HEAD 2^>nul`) do set "SOURCE_COMMIT=%%i"
for /f "usebackq delims=" %%i in (`node -e "try{const m=require('./packages/server/dist/config/build-meta.json');console.log(m.commit || '')}catch{}" 2^>nul`) do set "DIST_COMMIT=%%i"
if not "!SOURCE_VER!"=="" if not "!DIST_VER!"=="" if not "!SOURCE_VER!"=="!DIST_VER!" (
echo [WARN] Version mismatch: source v!SOURCE_VER! but dist has v!DIST_VER!
echo [..] Dependencies and build will be refreshed before startup.
set "INSTALL_REQUIRED=1"
set "BUILD_REQUIRED=1"
)
if not "!SOURCE_COMMIT!"=="" if /I not "!SOURCE_COMMIT!"=="!DIST_COMMIT!" (
echo [WARN] Build commit mismatch: source !SOURCE_COMMIT! but dist has !DIST_COMMIT!
echo [..] Dependencies and build will be refreshed before startup.
set "INSTALL_REQUIRED=1"
set "BUILD_REQUIRED=1"
)
:skip_version_check
:: Install dependencies if needed
if not exist "node_modules" set "INSTALL_REQUIRED=1"
node scripts\check-workspace-install.mjs >nul 2>&1
if errorlevel 1 set "INSTALL_REQUIRED=1"
if not "!INSTALL_REQUIRED!"=="1" goto :skip_install
echo.
echo [..] Installing dependencies...
echo This may take a few minutes.
echo.
call :run_pnpm install --frozen-lockfile --prefer-offline
if errorlevel 1 echo [ERROR] Failed to install dependencies. & pause & exit /b 1
:skip_install
:skip_env
:: Optional AI sprite background remover
if defined BACKGROUNDREMOVER_AUTO_INSTALL (
if /I "%BACKGROUNDREMOVER_AUTO_INSTALL%"=="1" goto install_bgremover
if /I "%BACKGROUNDREMOVER_AUTO_INSTALL%"=="true" goto install_bgremover
if /I "%BACKGROUNDREMOVER_AUTO_INSTALL%"=="yes" goto install_bgremover
if /I "%BACKGROUNDREMOVER_AUTO_INSTALL%"=="on" goto install_bgremover
)
goto skip_bgremover
:install_bgremover
echo [..] Ensuring optional AI background remover runtime...
call :run_pnpm backgroundremover:install -- --if-missing
if errorlevel 1 echo [WARN] Optional background remover install failed; built-in cleanup will still work.
:skip_bgremover
:: Build if needed
if not exist "packages\shared\dist\constants\defaults.js" set "BUILD_REQUIRED=1"
if not exist "packages\server\dist\index.js" set "BUILD_REQUIRED=1"
if not exist "packages\client\dist\index.html" set "BUILD_REQUIRED=1"
if "!BUILD_REQUIRED!"=="1" (
echo [..] Cleaning stale build artifacts...
call :run_pnpm clean:stale-client
if errorlevel 1 echo [ERROR] Failed to clean stale client artifacts. & pause & exit /b 1
call :run_pnpm --filter @marinara-engine/shared run clean
if errorlevel 1 echo [ERROR] Failed to clean shared build artifacts. & pause & exit /b 1
call :run_pnpm --filter @marinara-engine/server run clean
if errorlevel 1 echo [ERROR] Failed to clean server build artifacts. & pause & exit /b 1
call :run_pnpm --filter @marinara-engine/client run clean
if errorlevel 1 echo [ERROR] Failed to clean client build artifacts. & pause & exit /b 1
echo [..] Building Marinara Engine...
call :run_pnpm --filter @marinara-engine/shared build
if errorlevel 1 echo [ERROR] Failed to build shared package. & pause & exit /b 1
call :run_pnpm --filter @marinara-engine/server --filter @marinara-engine/client --parallel run build
if errorlevel 1 echo [ERROR] Failed to build server or client package. & pause & exit /b 1
)
:: Database migrations are handled automatically at server startup by runMigrations()
:: Set defaults only if not already set
set NODE_ENV=production
if not defined PORT set PORT=7860
if not defined HOST set HOST=0.0.0.0
if not defined SIDECAR_RUNTIME_INSTALL_ENABLED set SIDECAR_RUNTIME_INSTALL_ENABLED=true
set PROTOCOL=http
if defined SSL_CERT if defined SSL_KEY set PROTOCOL=https
set "BROWSER_HOST=%HOST%"
if "%BROWSER_HOST%"=="" set "BROWSER_HOST=127.0.0.1"
if "%BROWSER_HOST%"=="0.0.0.0" set "BROWSER_HOST=127.0.0.1"
if "%BROWSER_HOST%"=="::" set "BROWSER_HOST=127.0.0.1"
set "AUTO_OPEN_BROWSER_ENABLED=1"
if defined AUTO_OPEN_BROWSER (
if /I "%AUTO_OPEN_BROWSER%"=="0" set "AUTO_OPEN_BROWSER_ENABLED="
if /I "%AUTO_OPEN_BROWSER%"=="false" set "AUTO_OPEN_BROWSER_ENABLED="
if /I "%AUTO_OPEN_BROWSER%"=="no" set "AUTO_OPEN_BROWSER_ENABLED="
if /I "%AUTO_OPEN_BROWSER%"=="off" set "AUTO_OPEN_BROWSER_ENABLED="
)
node scripts\check-port-available.mjs
if errorlevel 1 (
pause
goto :eof
)
echo.
echo ==========================================
echo Starting Marinara Engine on %PROTOCOL%://%HOST%:%PORT%
if not "%BROWSER_HOST%"=="%HOST%" echo Local browser URL: %PROTOCOL%://%BROWSER_HOST%:%PORT%
echo Press Ctrl+C to stop
echo ==========================================
echo.
:: Open browser after a short delay (use explorer.exe as fallback)
if defined AUTO_OPEN_BROWSER_ENABLED (
start "" cmd /c "timeout /t 4 /nobreak >nul && start %PROTOCOL%://%BROWSER_HOST%:%PORT% || explorer %PROTOCOL%://%BROWSER_HOST%:%PORT%"
) else (
echo [OK] Auto-open disabled ^(AUTO_OPEN_BROWSER=%AUTO_OPEN_BROWSER%^)
)
:: Start server
cd packages\server
node dist/index.js
if errorlevel 1 (
echo.
echo [ERROR] Server exited unexpectedly. See the error above.
echo.
pause
)
goto :eof
:run_pnpm
if /I "%PNPM_RUNNER%"=="corepack" (
call corepack pnpm@%PNPM_DESCRIPTOR% --config.trustPolicy=off --config.confirmModulesPurge=false %*
) else (
if /I "%PNPM_RUNNER%"=="npx" (
call npx --yes pnpm@%PNPM_VERSION% --config.trustPolicy=off --config.confirmModulesPurge=false %*
) else (
call pnpm --config.trustPolicy=off --config.confirmModulesPurge=false %*
)
)
exit /b %errorlevel%
:resolve_pnpm_runner
set "PNPM_DESCRIPTOR="
for /f "usebackq delims=" %%i in (`node -p "JSON.parse(require('fs').readFileSync('package.json','utf8')).packageManager?.replace(/^^pnpm@/, '') || ''"`) do set "PNPM_DESCRIPTOR=%%i"
if not defined PNPM_DESCRIPTOR (
echo [ERROR] Could not read the pinned pnpm descriptor from package.json.
exit /b 1
)
set "PNPM_VERSION="
for /f "tokens=1 delims=+" %%i in ("!PNPM_DESCRIPTOR!") do set "PNPM_VERSION=%%i"
if not defined PNPM_VERSION (
echo [ERROR] The pinned pnpm descriptor in package.json has no version.
exit /b 1
)
set "PNPM_RUNNER=pnpm"
set "CURRENT_PNPM_VERSION="
where corepack >nul 2>&1
if not errorlevel 1 (
echo [..] Aligning pnpm to !PNPM_VERSION! via Corepack...
for /f "usebackq delims=" %%i in (`corepack pnpm@!PNPM_DESCRIPTOR! --version 2^>nul`) do set "CURRENT_PNPM_VERSION=%%i"
if /I "!CURRENT_PNPM_VERSION!"=="!PNPM_VERSION!" (
set "PNPM_RUNNER=corepack"
) else (
set "CURRENT_PNPM_VERSION="
)
)
if not defined CURRENT_PNPM_VERSION (
where pnpm >nul 2>&1
if not errorlevel 1 (
for /f "usebackq delims=" %%i in (`pnpm --version 2^>nul`) do set "CURRENT_PNPM_VERSION=%%i"
if /I "!CURRENT_PNPM_VERSION!"=="!PNPM_VERSION!" (
echo [..] Using installed pnpm !CURRENT_PNPM_VERSION!
) else (
if defined CURRENT_PNPM_VERSION echo [..] Installed pnpm !CURRENT_PNPM_VERSION! does not match required !PNPM_VERSION!; trying a pinned temporary runner...
set "CURRENT_PNPM_VERSION="
)
)
)
if not defined CURRENT_PNPM_VERSION (
echo [..] Using temporary pnpm !PNPM_VERSION! via npx...
for /f "usebackq delims=" %%i in (`npx --yes pnpm@!PNPM_VERSION! --version 2^>nul`) do set "CURRENT_PNPM_VERSION=%%i"
if /I "!CURRENT_PNPM_VERSION!"=="!PNPM_VERSION!" (
set "PNPM_RUNNER=npx"
) else (
set "CURRENT_PNPM_VERSION="
)
)
if not defined CURRENT_PNPM_VERSION (
echo [ERROR] Failed to make pnpm !PNPM_VERSION! available.
echo Marinara can run without a global pnpm install, but Node.js must provide Corepack or npx/npm.
echo Reinstall Node.js 24 LTS with npm enabled, or run: npm install -g pnpm@!PNPM_VERSION!
exit /b 1
)
echo [OK] pnpm !CURRENT_PNPM_VERSION! ready
exit /b 0