Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): platform-tools CLI 在不支持的平台优雅跳过,并修正测试覆盖
Lizi73999dc62f27
diff --git a/apps/desktop/scripts/ensure-android-platform-tools.mjs b/apps/desktop/scripts/ensure-android-platform-tools.mjsindex 2533d22dc8..1c8f82fd07 100644--- a/apps/desktop/scripts/ensure-android-platform-tools.mjs+++ b/apps/desktop/scripts/ensure-android-platform-tools.mjs@@ -223,7 +223,7 @@ async function extractVerifiedFiles(zipBuffer, platformKey, destDir) {/*** 确保指定平台的 platform-tools 二进制就位。*- * @returns {Promise<{ status: 'skipped'|'installed', version: string, files?: string[] }>}+ * @returns {Promise<{ status: 'skipped'|'installed', version: string, files?: string[], source?: string }>}*/export async function ensureAndroidPlatformTools({platformKey = currentPlatformKey(),@@ -363,6 +363,8 @@ if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.aconst p = path.join(BIN_ROOT, key, name);console.log(`${fs.existsSync(p) ? sha256File(p) : '(missing)'} ${name}`);}+ } else if (!args.platformKey || !isSupportedPlatformKey(args.platformKey)) {+ log(`${args.platformKey ?? process.platform + '-' + process.arch}: not a supported platform, skip`);} else {ensureAndroidPlatformTools(args).catch((err) => {console.error(`ERROR: ${err.message}`);diff --git a/scripts/__tests__/ensure-android-platform-tools.test.mjs b/scripts/__tests__/ensure-android-platform-tools.test.mjsindex c6850685de..12a2a33216 100644--- a/scripts/__tests__/ensure-android-platform-tools.test.mjs+++ b/scripts/__tests__/ensure-android-platform-tools.test.mjs@@ -139,9 +139,21 @@ test('verifyInstalled: source.properties 版本与 PINNED 不匹配时不算就});test('verifyInstalled: 文件缺失时不算就位', () => {+ // 只有 source.properties,三个二进制文件全部缺失 → 命中 "missing" 分支。+ const root = tmpBinRoot('win32-x64', {+ 'source.properties': 'Pkg.Revision=32.0.0',+ });+ const r = verifyInstalled('win32-x64', root);+ assert.equal(r.ok, false);+ assert.match(r.reason, /missing/);+});++test('verifyInstalled: 文件内容被篡改时报 sha256 不匹配', () => {const root = tmpBinRoot('win32-x64', {'source.properties': 'Pkg.Revision=32.0.0','adb.exe': 'not the real adb',+ 'AdbWinApi.dll': 'fake dll',+ 'AdbWinUsbApi.dll': 'fake dll',});const r = verifyInstalled('win32-x64', root);assert.equal(r.ok, false);