From cdec918a5bfd6638de53247a2930c5f097bb4149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=9F=BA=E5=B2=A9=EF=BC=88engineering-lead?= =?UTF-8?q?=EF=BC=89?= Date: Tue, 20 Oct 2026 17:45:10 +0800 Subject: [PATCH] =?UTF-8?q?W4=20=E9=A6=96=E8=B7=91=E5=8C=85=EF=BC=9Afirst?= =?UTF-8?q?=5Frun.bat=20=E4=B8=80=E9=94=AE=20headless=20=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=20+=20README=20Quick=20start=20+=20logs/=20=E5=BF=BD=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - first_run.bat(纯 ASCII / CRLF):GODOT_EXE 顶部可覆写;where godot + 5 条便携路径探测;四步 headless(import / schema-validate / 单测 8 用例 / sim 门);任一步失败不中断,末尾汇总表 + logs\first_run.log 合并日志;双击运行自动 pause;已用 stub godot 实测三条路径(全 PASS / 全 FAIL / not found) - README.md:顶部 Quick start(首跑)3 行指向 first_run.bat 与首跑指南;.gitignore 增加 logs/ --- .gitignore | 3 ++ README.md | 6 +++ first_run.bat | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 first_run.bat diff --git a/.gitignore b/.gitignore index 4b5829e..fd7d60e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ desktop.ini # ---- 编辑器临时 ---- *.tmp *.bak + +# ---- 首跑日志(first_run.bat 产物)---- +logs/ diff --git a/README.md b/README.md index 193818e..266b8a2 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,12 @@ 架构基线:`docs/architecture/2026-10-19-F-architecture.md`(v1.0,2026-10-19) 工程宪法摘要:`CLAUDE.md`(必读) +## Quick start(首跑) + +1. 装 Godot 4.7.x 便携版(解压即用,建议放 `D:\Godot\Godot.exe`)→ 双击仓库根目录 `first_run.bat`:自动探测引擎并跑四条 headless 检查(import / schema / 单测 8 用例 / sim 门),合并日志落 `logs\first_run.log`; +2. 末尾汇总表全 PASS 后:命令行 `godot --path .`,或编辑器打开项目按 F5,直接玩灰盒(调试键 F5 / F6 / F1-F4 / F9); +3. 完整首跑指南(安装细节 + 预期输出对照 + 失败处置):`docs/engineering/2026-10-20-f-first-run-guide.md`(工作区工程文档,不在本仓库内)。 + ## 1. 环境要求 | 项 | 要求 | 备注 | diff --git a/first_run.bat b/first_run.bat new file mode 100644 index 0000000..4ba04bc --- /dev/null +++ b/first_run.bat @@ -0,0 +1,132 @@ +@echo off +rem ============================================================================ +rem first_run.bat - WRATH OF THE DEAD (project F) one-click headless check +rem +rem Pure ASCII by design: non-ASCII bytes inside .bat files get mangled by +rem this machine's console code page. User-facing text stays English here; +rem the Chinese first-run guide lives at: +rem docs/engineering/2026-10-20-f-first-run-guide.md (workspace docs folder) +rem +rem Runs the same four headless checks as .github/workflows/ci.yml: +rem step 1 import --headless --path . --import +rem step 2 schema-validate -s res://src/tools/import_main.gd -- --validate-only +rem step 3 unit-tests -s res://tests/unit/test_runner.gd +rem step 4 sim-gates -s res://src/core/sim/sim_main.gd +rem Combined log: logs\first_run.log. Exit code 0 only if all four steps pass. +rem ============================================================================ + +setlocal EnableExtensions +chcp 65001 >nul +title WRATH OF THE DEAD - first run +cd /d "%~dp0" + +rem --- User override: hardcode your Godot path here (empty = auto-detect) ----- +set "GODOT_EXE=" + +set "LOG=%CD%\logs\first_run.log" +if not exist "logs\" mkdir "logs" +if exist "%LOG%" del /q "%LOG%" + +rem --- 1. Locate Godot --------------------------------------------------------- +if defined GODOT_EXE ( + if exist "%GODOT_EXE%" ( + set "GODOT=%GODOT_EXE%" + ) else ( + echo GODOT_EXE is set but the file does not exist: %GODOT_EXE% + exit /b 1 + ) +) +if not defined GODOT for /f "delims=" %%i in ('where godot 2^>nul') do if not defined GODOT set "GODOT=%%~i" +if not defined GODOT for %%i in ("%USERPROFILE%\Desktop\Godot*.exe") do set "GODOT=%%~i" +if not defined GODOT for %%i in ("D:\Godot\Godot*.exe") do set "GODOT=%%~i" +if not defined GODOT for %%i in ("%LOCALAPPDATA%\Programs\Godot\Godot*.exe") do set "GODOT=%%~i" +if not defined GODOT for %%i in ("%LOCALAPPDATA%\Microsoft\WinGet\Packages\GodotEngine.GodotEngine*\Godot.exe") do set "GODOT=%%~i" + +if not defined GODOT ( + echo Godot not found. Extract Godot 4.7.x zip anywhere and either add to PATH or edit GODOT_EXE at top of this file + echo Recommended portable layout: D:\Godot\Godot.exe - this script probes that path by default + exit /b 1 +) +echo Using Godot: "%GODOT%" +echo Project root: %CD% +echo. + +> "%LOG%" echo ===== first_run started %DATE% %TIME% ===== + +rem --- 2. Four headless steps --------------------------------------------------- +> "logs\_step1.out" echo ===== step 1: import ===== +echo ===== step 1: import ===== +call "%GODOT%" --headless --path . --import >> "logs\_step1.out" 2>&1 +set "RC1=%ERRORLEVEL%" +echo ===== step 1: import - exit code %RC1% ===== +type "logs\_step1.out" >> "%LOG%" +>> "%LOG%" echo ===== step 1: import - exit code %RC1% ===== +type "logs\_step1.out" +echo. + +> "logs\_step2.out" echo ===== step 2: schema-validate ===== +echo ===== step 2: schema-validate ===== +call "%GODOT%" --headless --path . -s res://src/tools/import_main.gd -- --validate-only >> "logs\_step2.out" 2>&1 +set "RC2=%ERRORLEVEL%" +echo ===== step 2: schema-validate - exit code %RC2% ===== +type "logs\_step2.out" >> "%LOG%" +>> "%LOG%" echo ===== step 2: schema-validate - exit code %RC2% ===== +type "logs\_step2.out" +echo. + +> "logs\_step3.out" echo ===== step 3: unit-tests ===== +echo ===== step 3: unit-tests ===== +call "%GODOT%" --headless --path . -s res://tests/unit/test_runner.gd >> "logs\_step3.out" 2>&1 +set "RC3=%ERRORLEVEL%" +echo ===== step 3: unit-tests - exit code %RC3% ===== +type "logs\_step3.out" >> "%LOG%" +>> "%LOG%" echo ===== step 3: unit-tests - exit code %RC3% ===== +type "logs\_step3.out" +echo. + +> "logs\_step4.out" echo ===== step 4: sim-gates ===== +echo ===== step 4: sim-gates ===== +call "%GODOT%" --headless --path . -s res://src/core/sim/sim_main.gd >> "logs\_step4.out" 2>&1 +set "RC4=%ERRORLEVEL%" +echo ===== step 4: sim-gates - exit code %RC4% ===== +type "logs\_step4.out" >> "%LOG%" +>> "%LOG%" echo ===== step 4: sim-gates - exit code %RC4% ===== +type "logs\_step4.out" +echo. + +rem --- 3. Summary --------------------------------------------------------------- +echo ===== first_run summary ===== +>> "%LOG%" echo ===== first_run summary ===== +if "%RC1%"=="0" (set "R1=PASS") else (set "R1=FAIL") +if "%RC2%"=="0" (set "R2=PASS") else (set "R2=FAIL") +if "%RC3%"=="0" (set "R3=PASS") else (set "R3=FAIL") +if "%RC4%"=="0" (set "R4=PASS") else (set "R4=FAIL") +echo step 1 import exit %RC1% %R1% +echo step 2 schema-validate exit %RC2% %R2% +echo step 3 unit-tests exit %RC3% %R3% +echo step 4 sim-gates exit %RC4% %R4% +>> "%LOG%" echo step 1 import exit %RC1% %R1% +>> "%LOG%" echo step 2 schema-validate exit %RC2% %R2% +>> "%LOG%" echo step 3 unit-tests exit %RC3% %R3% +>> "%LOG%" echo step 4 sim-gates exit %RC4% %R4% +set "ALL=1" +if not "%RC1%"=="0" set "ALL=0" +if not "%RC2%"=="0" set "ALL=0" +if not "%RC3%"=="0" set "ALL=0" +if not "%RC4%"=="0" set "ALL=0" +if "%ALL%"=="1" goto :allpass +echo Some checks FAILED. Open logs\first_run.log and send the full error text back to engineering - do not fix code yourself. +goto :endlog + +:allpass +echo All headless checks passed. Now run: godot --path . (or open project in editor and press F5) to play the graybox build. Debug keys: F5 next hall gate, F6 boss challenge, F1-F4 force events, F9 hotkey list. + +:endlog +del /q "logs\_step*.out" 2>nul +echo Log: %CD%\logs\first_run.log + +rem Keep the window open when launched by double-click (cmdcmdline then has /c). +echo.%cmdcmdline%| find /i "/c " >nul && pause + +if "%ALL%"=="0" exit /b 1 +exit /b 0