summaryrefslogtreecommitdiff
path: root/packages/cli/src
diff options
context:
space:
mode:
authorYuki Okita <[email protected]>2025-07-18 09:44:45 +0900
committerGitHub <[email protected]>2025-07-18 00:44:45 +0000
commit584a50a3422fc543a0f861cd946fa0403acc12f0 (patch)
tree8e514baa322b2c8ed95526c269ddbb8845b6fcb7 /packages/cli/src
parentca07b5b0c41defb27d6b156faba356ab900ee092 (diff)
fix(cli): not show update avaialble messages when running gemini-cli locally (#4052)
Diffstat (limited to 'packages/cli/src')
-rw-r--r--packages/cli/src/ui/utils/updateCheck.test.ts17
-rw-r--r--packages/cli/src/ui/utils/updateCheck.ts5
2 files changed, 22 insertions, 0 deletions
diff --git a/packages/cli/src/ui/utils/updateCheck.test.ts b/packages/cli/src/ui/utils/updateCheck.test.ts
index 6d3c8b77..975c320d 100644
--- a/packages/cli/src/ui/utils/updateCheck.test.ts
+++ b/packages/cli/src/ui/utils/updateCheck.test.ts
@@ -20,6 +20,23 @@ vi.mock('update-notifier', () => ({
describe('checkForUpdates', () => {
beforeEach(() => {
vi.resetAllMocks();
+ // Clear DEV environment variable before each test
+ delete process.env.DEV;
+ });
+
+ it('should return null when running from source (DEV=true)', async () => {
+ process.env.DEV = 'true';
+ getPackageJson.mockResolvedValue({
+ name: 'test-package',
+ version: '1.0.0',
+ });
+ updateNotifier.mockReturnValue({
+ update: { current: '1.0.0', latest: '1.1.0' },
+ });
+ const result = await checkForUpdates();
+ expect(result).toBeNull();
+ expect(getPackageJson).not.toHaveBeenCalled();
+ expect(updateNotifier).not.toHaveBeenCalled();
});
it('should return null if package.json is missing', async () => {
diff --git a/packages/cli/src/ui/utils/updateCheck.ts b/packages/cli/src/ui/utils/updateCheck.ts
index 6be5effc..904a9890 100644
--- a/packages/cli/src/ui/utils/updateCheck.ts
+++ b/packages/cli/src/ui/utils/updateCheck.ts
@@ -10,6 +10,11 @@ import { getPackageJson } from '../../utils/package.js';
export async function checkForUpdates(): Promise<string | null> {
try {
+ // Skip update check when running from source (development mode)
+ if (process.env.DEV === 'true') {
+ return null;
+ }
+
const packageJson = await getPackageJson();
if (!packageJson || !packageJson.name || !packageJson.version) {
return null;