refactor(core): Move getPackageJson utility to core package (#12224)

This commit is contained in:
Shreya Keshive
2025-10-29 13:23:35 -07:00
committed by GitHub
parent b31b786db7
commit 3e9701861e
9 changed files with 61 additions and 49 deletions
+7 -2
View File
@@ -4,9 +4,14 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { getPackageJson } from './package.js';
import { getPackageJson } from '@google/gemini-cli-core';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export async function getCliVersion(): Promise<string> {
const pkgJson = await getPackageJson();
const pkgJson = await getPackageJson(__dirname);
return process.env['CLI_VERSION'] || pkgJson?.version || 'unknown';
}