From 9eca3bd657cce76fd921908504329c320200c867 Mon Sep 17 00:00:00 2001 From: Linghong Date: Mon, 27 Jul 2026 05:47:09 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20AI=20=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E5=88=9B=E4=BD=9C=20Shell=20ESLint=20=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 整理配置检查脚本与智能体测试的导入顺序。 将配置向导中的常量条件循环改为等价循环语法。 --- .../scripts/check-config.mjs | 8 +++---- .../scripts/game-creator-config-wizard.mjs | 8 +++---- .../tests/agentSwarmTestEntry.test.ts | 24 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/apps/ai-game-creator-shell/scripts/check-config.mjs b/apps/ai-game-creator-shell/scripts/check-config.mjs index e79274176..ec67dde0b 100644 --- a/apps/ai-game-creator-shell/scripts/check-config.mjs +++ b/apps/ai-game-creator-shell/scripts/check-config.mjs @@ -5,6 +5,10 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; +import { + appIdentifier, + defaultRealSwarmTestTask, +} from './agent-swarm-test-chat.mjs'; import { askHidden, assertSafeGameCreatorConfigDestination, @@ -13,10 +17,6 @@ import { writeGameCreatorConfigAtomically, writeGameCreatorWizardConfig, } from './game-creator-config-wizard.mjs'; -import { - appIdentifier, - defaultRealSwarmTestTask, -} from './agent-swarm-test-chat.mjs'; const packageConfig = JSON.parse( fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'), diff --git a/apps/ai-game-creator-shell/scripts/game-creator-config-wizard.mjs b/apps/ai-game-creator-shell/scripts/game-creator-config-wizard.mjs index f196671f6..6751f1f4a 100644 --- a/apps/ai-game-creator-shell/scripts/game-creator-config-wizard.mjs +++ b/apps/ai-game-creator-shell/scripts/game-creator-config-wizard.mjs @@ -446,7 +446,7 @@ export async function readGameCreatorWizardConfigState( async function resolvePathThroughExistingAncestor(targetPath) { let cursor = path.resolve(targetPath); const missingSegments = []; - while (true) { + for (;;) { try { const canonical = await realpath(cursor); return path.join(canonical, ...missingSegments.reverse()); @@ -472,7 +472,7 @@ function pathIsWithin(rootPath, targetPath) { async function findContainingGitRoot(targetPath, runGit) { let cursor = targetPath; - while (true) { + for (;;) { const metadata = await lstat(cursor).catch((error) => { if (error?.code === 'ENOENT' || error?.code === 'ENOTDIR') return null; throw error; @@ -808,7 +808,7 @@ export async function askHidden( async function askChoice(title, choices, fallbackIndex = 0) { console.log(title); choices.forEach((choice, index) => console.log(` ${index + 1}. ${choice}`)); - while (true) { + for (;;) { const answer = await askVisible(`请选择 [${fallbackIndex + 1}]: `); if (!answer) return fallbackIndex; const index = Number(answer) - 1; @@ -819,7 +819,7 @@ async function askChoice(title, choices, fallbackIndex = 0) { } async function askRequired(prompt, fallback = '') { - while (true) { + for (;;) { const value = await askVisible(prompt, fallback); if (value.trim()) return value.trim(); console.log('该项不能为空。'); diff --git a/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts b/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts index 24605195a..71e35ab8a 100644 --- a/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts +++ b/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts @@ -17,16 +17,6 @@ import { deflateSync } from 'node:zlib'; import { describe, expect, it } from 'vitest'; -import { - buildGameCreatorWizardConfig, - gameCreatorProviderPresets, - normalizeWizardBaseUrl, - parseConfigWizardArguments, - readGameCreatorWizardConfigState, - resolveGameCreatorAppConfigDir, - writeGameCreatorConfigAtomically, - writeGameCreatorWizardConfig, -} from '../scripts/game-creator-config-wizard.mjs'; import { appIdentifier, buildCargoCliArguments, @@ -51,21 +41,31 @@ import { prepareSwarmTestRuntimeConfig, removeDirectoryWithTimeout, requiredSwarmManifestTaskIds, - runnerEndpointFileName, resolveSwarmTestTimeoutMs, + runnerEndpointFileName, shouldStartPersistentPreview, + terminateChildTree, testProjectPrefix, testProjectSentinelName, testProjectSentinelSchema, testRuntimeConfigPrefix, testRuntimeConfigSentinelName, testRuntimeConfigSentinelSchema, - terminateChildTree, ungeneratedGameEntryMarker, validatePngBytes, validatePreviewUrl, validateSwarmProjectArtifacts, } from '../scripts/agent-swarm-test-chat.mjs'; +import { + buildGameCreatorWizardConfig, + gameCreatorProviderPresets, + normalizeWizardBaseUrl, + parseConfigWizardArguments, + readGameCreatorWizardConfigState, + resolveGameCreatorAppConfigDir, + writeGameCreatorConfigAtomically, + writeGameCreatorWizardConfig, +} from '../scripts/game-creator-config-wizard.mjs'; const appRoot = path.resolve(fileURLToPath(new URL('..', import.meta.url)));