pre-release commit

This commit is contained in:
koalazf.99
2025-07-22 19:59:07 +08:00
parent c5dee4bb17
commit a9d6965bef
485 changed files with 111444 additions and 2 deletions

View File

@@ -0,0 +1,61 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'fs/promises';
import * as os from 'os';
import semver from 'semver';
type WarningCheck = {
id: string;
check: (workspaceRoot: string) => Promise<string | null>;
};
// Individual warning checks
const homeDirectoryCheck: WarningCheck = {
id: 'home-directory',
check: async (workspaceRoot: string) => {
try {
const [workspaceRealPath, homeRealPath] = await Promise.all([
fs.realpath(workspaceRoot),
fs.realpath(os.homedir()),
]);
if (workspaceRealPath === homeRealPath) {
return 'You are running Qwen Code in your home directory. It is recommended to run in a project-specific directory.';
}
return null;
} catch (_err: unknown) {
return 'Could not verify the current directory due to a file system error.';
}
},
};
const nodeVersionCheck: WarningCheck = {
id: 'node-version',
check: async (_workspaceRoot: string) => {
const minMajor = 20;
const major = semver.major(process.versions.node);
if (major < minMajor) {
return `You are using Node.js v${process.versions.node}. Gemini CLI requires Node.js ${minMajor} or higher for best results.`;
}
return null;
},
};
// All warning checks
const WARNING_CHECKS: readonly WarningCheck[] = [
homeDirectoryCheck,
nodeVersionCheck,
];
export async function getUserStartupWarnings(
workspaceRoot: string,
): Promise<string[]> {
const results = await Promise.all(
WARNING_CHECKS.map((check) => check.check(workspaceRoot)),
);
return results.filter((msg) => msg !== null);
}