From 66cf0bcfc8f5de68277ef27f41abbcb25a766843 Mon Sep 17 00:00:00 2001 From: menghao Date: Fri, 31 Jul 2026 14:29:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E9=BD=90AGC=E8=B7=A8=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E8=B7=AF=E5=BE=84=E7=A1=AE=E5=AE=9A=E6=80=A7=E5=9B=9E?= =?UTF-8?q?=E5=BD=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增链接父目录与不存在叶目录的跨平台测试 将临时路径规范化纳入可靠清理边界 同步跨平台路径回归文档与踩坑记录 --- .../scripts/check-config.mjs | 23 ++++++++++++++++++- docs/project-memory/shared-memory/pitfalls.md | 2 +- ...案】AI游戏创作智能体App实施计划-2026-06-24.md | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/apps/ai-game-creator-shell/scripts/check-config.mjs b/apps/ai-game-creator-shell/scripts/check-config.mjs index e001a6279..2f858797a 100644 --- a/apps/ai-game-creator-shell/scripts/check-config.mjs +++ b/apps/ai-game-creator-shell/scripts/check-config.mjs @@ -435,8 +435,29 @@ async function runConfigWizardRegressionChecks() { const testRoot = fs.mkdtempSync( path.join(os.tmpdir(), 'genarrative-agc-config-check-'), ); - const canonicalTestRoot = fs.realpathSync.native(testRoot); try { + const canonicalTestRoot = fs.realpathSync.native(testRoot); + const realConfigAncestor = path.join(testRoot, 'real-config-ancestor'); + const linkedConfigAncestor = path.join(testRoot, 'linked-config-ancestor'); + fs.mkdirSync(realConfigAncestor); + fs.symlinkSync( + realConfigAncestor, + linkedConfigAncestor, + process.platform === 'win32' ? 'junction' : 'dir', + ); + const missingLinkedConfigDir = path.join( + linkedConfigAncestor, + 'missing-appdata', + ); + assert.equal(fs.existsSync(missingLinkedConfigDir), false); + assert.equal( + await assertSafeGameCreatorConfigDestination(missingLinkedConfigDir), + path.join( + fs.realpathSync.native(realConfigAncestor), + 'missing-appdata', + ), + ); + const gitRoot = path.join(testRoot, 'tracked-repository'); const trackedConfigDir = path.join(gitRoot, 'runtime-config'); fs.mkdirSync(trackedConfigDir, { recursive: true }); diff --git a/docs/project-memory/shared-memory/pitfalls.md b/docs/project-memory/shared-memory/pitfalls.md index c65048c88..70e1f2665 100644 --- a/docs/project-memory/shared-memory/pitfalls.md +++ b/docs/project-memory/shared-memory/pitfalls.md @@ -3703,7 +3703,7 @@ - 处理:GUI 与 `npm run agc:config` 共用系统 AppData `game-creator.config.json`,终端隐藏输入 API Key 并禁止 `--api-key`;更新时保留 `agentLlm`、`editorApi`、`mcpServers` 等其它配置,POSIX 权限维持目录 `0700` / 文件 `0600` 并原子替换。显式 `--config-dir` 必须以 `world.genarrative.ai-game-creator` 为独立叶目录,不能让向导对 `/tmp`、AppData 根或共享目录整体 chmod / 重建 DACL。隐藏输入调用 `stdin.resume()` 后必须记住原 pause 状态,在成功、取消、异常和 `SIGINT / SIGTERM / SIGHUP` 路径恢复 raw mode 并 `pause()`,信号恢复后重发;只移除 `data` listener 会让 `--configure-only`、配置检查失败或 Ctrl+C 保持活动 stdin。缺配置时仅 TTY 人工会话可询问进入向导,非 TTY 立即失败并提示配置命令。 - Windows 密钥复制:`mode: 0o600` 和 POSIX `chmod` 在 Windows 上不能代替 DACL。隔离 AppData 目录必须先设置仅当前用户、禁止继承的 DACL;目标配置文件先以空文件创建并收紧 DACL,之后才允许把 API Key 字节写入。先 `copyFile` 再依赖 Rust 只读检查或事后收紧会留下密钥暴露窗口,也可能因继承 ACL 不满足 Runtime 合同而在首次 `--llm-status` 失败。 - Windows PowerShell 参数:不要把 DACL 目标路径和目录标记直接追加在 `powershell.exe -Command