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 1603c5383..0d0522f22 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 @@ -450,7 +450,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()); @@ -476,7 +476,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; @@ -812,7 +812,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; @@ -823,7 +823,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)));