From 3a6758095642e62f4db390745eee358a621cc846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Wed, 7 Oct 2026 14:04:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A0=A1=E9=AA=8C=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E6=BC=82=E7=A7=BB=E6=AF=94=E8=BE=83=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E9=A6=96=E5=B0=BE=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - resolve_project_verification_spec 对 actual/expected command 都做 trim,避免 package.json 脚本带首尾空格或换行时被误判成「脚本已变化」 --- .../src-tauri/src/project/verification.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/project/verification.rs b/apps/ai-game-creator-shell/src-tauri/src/project/verification.rs index 7ec522c4f..c2cc15b9c 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/project/verification.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/project/verification.rs @@ -388,7 +388,9 @@ pub(crate) fn resolve_project_verification_spec_with_cwd_at( .and_then(|scripts| scripts.get(script)) .and_then(serde_json::Value::as_str) .ok_or_else(|| format!("package.json 未定义 {script} 脚本"))?; - if actual_command != expected_command { + // 两边都 trim:调用方(如陶泥儿导出)给出的 expectedCommand 来自剥离空白后的脚本值, + // 而 package.json 里可能带首尾空格/换行;只按原始值比较会把「空白差异」误判成脚本漂移。 + if actual_command.trim() != expected_command.trim() { return Err(format!( "package.json 中的 {script} 脚本已变化,请重新读取后再确认执行" ));