clean up version lookup code (#804)

This commit is contained in:
Tommaso Sciortino
2025-06-06 16:21:20 -07:00
committed by GitHub
parent e94a10023d
commit 76ec9122c0
5 changed files with 39 additions and 23 deletions

View File

@@ -9,9 +9,7 @@ import { render } from 'ink';
import { App } from './ui/App.js';
import { loadCliConfig } from './config/config.js';
import { readStdin } from './utils/readStdin.js';
import { readPackageUp } from 'read-package-up';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { getCliVersion } from './utils/version.js';
import { sandbox_command, start_sandbox } from './utils/sandbox.js';
import { LoadedSettings, loadSettings } from './config/settings.js';
import { themeManager } from './ui/themes/theme-manager.js';
@@ -34,9 +32,6 @@ import {
WriteFileTool,
} from '@gemini-code/core';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export async function main() {
// warn about deprecated environment variables
if (process.env.GEMINI_CODE_MODEL) {
@@ -107,9 +102,7 @@ export async function main() {
// Render UI, passing necessary config values. Check that there is no command line question.
if (process.stdin.isTTY && input?.length === 0) {
const readUpResult = await readPackageUp({ cwd: __dirname });
const cliVersion =
process.env.CLI_VERSION || readUpResult?.packageJson.version || 'unknown';
const cliVersion = await getCliVersion();
render(
<React.StrictMode>