repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/hooks/hookPlanner.test.ts | packages/core/src/hooks/hookPlanner.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { HookPlanner } from './hookPlanner.js';
import type { HookRegistry, HookRegistryEntry } from './hookRegistry.js';
import { ConfigSource, HookEventName, HookType... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/hooks/hookPlanner.ts | packages/core/src/hooks/hookPlanner.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { HookRegistry, HookRegistryEntry } from './hookRegistry.js';
import type { HookExecutionPlan } from './types.js';
import { getHookKey, type HookEventName } from './types.js';
import { debugLogger } from '../utils/debug... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/hooks/hookSystem.ts | packages/core/src/hooks/hookSystem.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Config } from '../config/config.js';
import { HookRegistry } from './hookRegistry.js';
import { HookRunner } from './hookRunner.js';
import { HookAggregator } from './hookAggregator.js';
import { HookPlanner } from '.... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/hooks/hookRunner.ts | packages/core/src/hooks/hookRunner.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { spawn } from 'node:child_process';
import type { HookConfig } from './types.js';
import { HookEventName, ConfigSource } from './types.js';
import type { Config } from '../config/config.js';
import type {
HookInput,
Hoo... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/fallback/handler.ts | packages/core/src/fallback/handler.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Config } from '../config/config.js';
import { AuthType } from '../core/contentGenerator.js';
import { openBrowserSecurely } from '../utils/secure-browser-launcher.js';
import { debugLogger } from '../utils/debugLogger... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/fallback/types.ts | packages/core/src/fallback/types.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { ModelSelectionResult } from '../availability/modelAvailabilityService.js';
import type {
FailureKind,
FallbackAction,
ModelPolicy,
} from '../availability/modelPolicy.js';
/**
* Defines the intent returned by ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/fallback/handler.test.ts | packages/core/src/fallback/handler.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
describe,
it,
expect,
vi,
beforeEach,
type Mock,
type MockInstance,
afterEach,
} from 'vitest';
import { handleFallback } from './handler.js';
import type { Config } from '../config/config.js';
import type ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/schemaValidator.test.ts | packages/core/src/utils/schemaValidator.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, expect, it } from 'vitest';
import { SchemaValidator } from './schemaValidator.js';
describe('SchemaValidator', () => {
it('should allow any params if schema is undefined', () => {
const params = {
f... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/extensionLoader.ts | packages/core/src/utils/extensionLoader.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { EventEmitter } from 'node:events';
import type { Config, GeminiCLIExtension } from '../config/config.js';
import { refreshServerHierarchicalMemory } from './memoryDiscovery.js';
export abstract class ExtensionLoader ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/testUtils.ts | packages/core/src/utils/testUtils.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Testing utilities for simulating 429 errors in unit tests
*/
let requestCounter = 0;
let simulate429Enabled = false;
let simulate429AfterRequests = 0;
let simulate429ForAuthType: string | undefined;
let fallbackOccurred = ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/LruCache.ts | packages/core/src/utils/LruCache.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export class LruCache<K, V> {
private cache: Map<K, V>;
private maxSize: number;
constructor(maxSize: number) {
this.cache = new Map<K, V>();
this.maxSize = maxSize;
}
get(key: K): V | undefined {
const valu... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/generateContentResponseUtilities.ts | packages/core/src/utils/generateContentResponseUtilities.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {
GenerateContentResponse,
Part,
FunctionCall,
PartListUnion,
} from '@google/genai';
import { getResponseText } from './partUtils.js';
import { supportsMultimodalFunctionResponse } from '../config/models.js';
i... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/userAccountManager.ts | packages/core/src/utils/userAccountManager.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import path from 'node:path';
import { promises as fsp, readFileSync } from 'node:fs';
import { Storage } from '../config/storage.js';
import { debugLogger } from './debugLogger.js';
interface UserAccounts {
active: string | nul... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/browser.ts | packages/core/src/utils/browser.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Determines if we should attempt to launch a browser for authentication
* based on the user's environment.
*
* This is an adaptation of the logic from the Google Cloud SDK.
* @returns True if the tool should attempt to la... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/errorParsing.ts | packages/core/src/utils/errorParsing.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { isApiError, isStructuredError } from './quotaErrorDetection.js';
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
import type { UserTierId } from '../code_assist/types.js';
import { AuthType } from '../cor... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/checkpointUtils.ts | packages/core/src/utils/checkpointUtils.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as path from 'node:path';
import type { GitService } from '../services/gitService.js';
import type { GeminiClient } from '../core/client.js';
import { getErrorMessage } from './errors.js';
import { z } from 'zod';
import t... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/exitCodes.ts | packages/core/src/utils/exitCodes.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export const ExitCodes = {
SUCCESS: 0,
FATAL_AUTHENTICATION_ERROR: 41,
FATAL_INPUT_ERROR: 42,
FATAL_CONFIG_ERROR: 52,
FATAL_CANCELLATION_ERROR: 130,
} as const;
| typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/events.test.ts | packages/core/src/utils/events.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, beforeEach } from 'vitest';
import {
CoreEventEmitter,
CoreEvent,
type UserFeedbackPayload,
} from './events.js';
describe('CoreEventEmitter', () => {
let events: CoreEventEmitter;
bef... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/installationManager.test.ts | packages/core/src/utils/installationManager.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Mock } from 'vitest';
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import { InstallationManager } from './installationManager.js';
import * as fs from 'node:fs';
import * as os from 'node:... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/stdio.ts | packages/core/src/utils/stdio.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { coreEvents } from './events.js';
// Capture the original stdout and stderr write methods before any monkey patching occurs.
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
const originalStderrWrite ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/gitIgnoreParser.ts | packages/core/src/utils/gitIgnoreParser.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs';
import * as path from 'node:path';
import ignore from 'ignore';
export interface GitIgnoreFilter {
isIgnored(filePath: string): boolean;
}
export class GitIgnoreParser implements GitIgnoreFilter {... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/delay.ts | packages/core/src/utils/delay.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Factory to create a standard abort error for delay helpers.
*/
export function createAbortError(): Error {
const abortError = new Error('Aborted');
abortError.name = 'AbortError';
return abortError;
}
/**
* Returns ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/messageInspectors.ts | packages/core/src/utils/messageInspectors.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Content } from '@google/genai';
export function isFunctionResponse(content: Content): boolean {
return (
content.role === 'user' &&
!!content.parts &&
content.parts.every((part) => !!part.functionRespon... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/llm-edit-fixer.ts | packages/core/src/utils/llm-edit-fixer.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { createHash } from 'node:crypto';
import { type Content, Type } from '@google/genai';
import { type BaseLlmClient } from '../core/baseLlmClient.js';
import { LruCache } from './LruCache.js';
import { promptIdContext } from ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/terminalSerializer.ts | packages/core/src/utils/terminalSerializer.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { IBufferCell, Terminal } from '@xterm/headless';
export interface AnsiToken {
text: string;
bold: boolean;
italic: boolean;
underline: boolean;
dim: boolean;
inverse: boolean;
fg: string;
bg: string;
}
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/extensionLoader.test.ts | packages/core/src/utils/extensionLoader.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
describe,
expect,
it,
vi,
beforeEach,
afterEach,
type MockInstance,
} from 'vitest';
import { SimpleExtensionLoader } from './extensionLoader.js';
import type { Config, GeminiCLIExtension } from '../config/co... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/errors.ts | packages/core/src/utils/errors.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
interface GaxiosError {
response?: {
data?: unknown;
};
}
export function isNodeError(error: unknown): error is NodeJS.ErrnoException {
return error instanceof Error && 'code' in error;
}
export function getErrorMessage... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/bfsFileSearch.ts | packages/core/src/utils/bfsFileSearch.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs/promises';
import * as fsSync from 'node:fs';
import * as path from 'node:path';
import type { FileDiscoveryService } from '../services/fileDiscoveryService.js';
import type { FileFilteringOptions } fro... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/shell-utils.test.ts | packages/core/src/utils/shell-utils.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
expect,
describe,
it,
beforeEach,
beforeAll,
vi,
afterEach,
} from 'vitest';
import {
escapeShellArg,
getCommandRoots,
getShellConfiguration,
initializeShellParsers,
stripShellWrapper,
hasRedirect... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/checkpointUtils.test.ts | packages/core/src/utils/checkpointUtils.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest';
import { z } from 'zod';
import {
getToolCallDataSchema,
generateCheckpointFileName,
formatCheckpointDisplayList,
getTruncatedCheckpointNames,
proc... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/nextSpeakerChecker.ts | packages/core/src/utils/nextSpeakerChecker.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Content } from '@google/genai';
import type { BaseLlmClient } from '../core/baseLlmClient.js';
import type { GeminiChat } from '../core/geminiChat.js';
import { isFunctionResponse } from './messageInspectors.js';
impo... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/debugLogger.test.ts | packages/core/src/utils/debugLogger.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, afterEach } from 'vitest';
import { debugLogger } from './debugLogger.js';
describe('DebugLogger', () => {
afterEach(() => {
vi.restoreAllMocks();
});
it('should call console.log with ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/session.ts | packages/core/src/utils/session.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { randomUUID } from 'node:crypto';
export const sessionId = randomUUID();
| typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/systemEncoding.ts | packages/core/src/utils/systemEncoding.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { execSync } from 'node:child_process';
import os from 'node:os';
import { detect as chardetDetect } from 'chardet';
import { debugLogger } from './debugLogger.js';
// Cache for system encoding to avoid repeated detection
/... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/version.test.ts | packages/core/src/utils/version.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { getVersion } from './version.js';
import { getPackageJson } from './package.js';
vi.mock('./package.js', () => ({
getPackageJson: vi.fn(),
}));
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/errors.test.ts | packages/core/src/utils/errors.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import {
isAuthenticationError,
UnauthorizedError,
toFriendlyError,
BadRequestError,
ForbiddenError,
} from './errors.js';
describe('isAuthenticationError', () => {
it('sh... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/memoryImportProcessor.test.ts | packages/core/src/utils/memoryImportProcessor.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import { marked } from 'marked';
import { processImports, validateImportPath } fro... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/paths.test.ts | packages/core/src/utils/paths.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { escapePath, unescapePath, isSubpath, shortenPath } from './paths.js';
describe('escapePath', () => {
it.each([
['spaces', 'my file.txt', 'my\\ file... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/debugLogger.ts | packages/core/src/utils/debugLogger.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/* eslint-disable no-console */
import * as fs from 'node:fs';
import * as util from 'node:util';
/**
* A simple, centralized logger for developer-facing debug messages.
*
* WHY USE THIS?
* - It makes the INTENT of the log cle... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/editor.ts | packages/core/src/utils/editor.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { execSync, spawn, spawnSync } from 'node:child_process';
import { debugLogger } from './debugLogger.js';
import { coreEvents, CoreEvent } from './events.js';
const GUI_EDITORS = [
'vscode',
'vscodium',
'windsurf',
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/textUtils.test.ts | packages/core/src/utils/textUtils.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { safeLiteralReplace } from './textUtils.js';
describe('safeLiteralReplace', () => {
it('returns original string when oldString empty or not found', () => {
expect(safeLi... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/googleErrors.ts | packages/core/src/utils/googleErrors.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview
* This file contains types and functions for parsing structured Google API errors.
*/
/**
* Based on google/rpc/error_details.proto
*/
export interface ErrorInfo {
'@type': 'type.googleapis.com/google.r... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/fetch.ts | packages/core/src/utils/fetch.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { getErrorMessage, isNodeError } from './errors.js';
import { URL } from 'node:url';
import { ProxyAgent, setGlobalDispatcher } from 'undici';
const PRIVATE_IP_RANGES = [
/^10\./,
/^127\./,
/^172\.(1[6-9]|2[0-9]|3[0-1... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/safeJsonStringify.ts | packages/core/src/utils/safeJsonStringify.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Safely stringifies an object to JSON, handling circular references by replacing them with [Circular].
*
* @param obj - The object to stringify
* @param space - Optional space parameter for formatting (defaults to no forma... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/shell-permissions.ts | packages/core/src/utils/shell-permissions.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { AnyToolInvocation } from '../index.js';
import type { Config } from '../config/config.js';
import { doesToolInvocationMatch } from './tool-utils.js';
import {
parseCommandDetails,
SHELL_TOOL_NAMES,
type ParsedCo... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/terminal.ts | packages/core/src/utils/terminal.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { writeToStdout } from './stdio.js';
export function enableMouseEvents() {
// Enable mouse tracking with SGR format
// ?1002h = button event tracking (clicks + drags + scroll wheel)
// ?1006h = SGR extended mouse mode... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/systemEncoding.test.ts | packages/core/src/utils/systemEncoding.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import { execSync } from 'node:child_process';
import * as os from 'node:os';
import { detect as chardetDetect } from 'chardet';
import { debugLogger } from ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/retry.ts | packages/core/src/utils/retry.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { GenerateContentResponse } from '@google/genai';
import { ApiError } from '@google/genai';
import {
TerminalQuotaError,
RetryableQuotaError,
classifyGoogleError,
} from './googleQuotaErrors.js';
import { delay, c... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/shell-permissions.test.ts | packages/core/src/utils/shell-permissions.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
expect,
describe,
it,
beforeEach,
beforeAll,
vi,
afterEach,
} from 'vitest';
import { initializeShellParsers } from './shell-utils.js';
import {
checkCommandPermissions,
isCommandAllowed,
isShellInvocat... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/gitUtils.ts | packages/core/src/utils/gitUtils.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs';
import * as path from 'node:path';
/**
* Checks if a directory is within a git repository
* @param directory The directory to check
* @returns true if the directory is in a git repository, false o... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/googleErrors.test.ts | packages/core/src/utils/googleErrors.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { parseGoogleApiError } from './googleErrors.js';
import type { QuotaFailure } from './googleErrors.js';
describe('parseGoogleApiError', () => {
it('should return null for no... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/ignorePatterns.ts | packages/core/src/utils/ignorePatterns.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import path from 'node:path';
import type { Config } from '../config/config.js';
import { getCurrentGeminiMdFilename } from '../tools/memoryTool.js';
/**
* Common ignore patterns used across multiple tools for basic exclusions.
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/pathCorrector.test.ts | packages/core/src/utils/pathCorrector.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as os from 'node:os';
import type { Config } from '../config/config.js';
import { ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/environmentContext.ts | packages/core/src/utils/environmentContext.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Part, Content } from '@google/genai';
import type { Config } from '../config/config.js';
import { getFolderStructure } from './getFolderStructure.js';
export const INITIAL_HISTORY_LENGTH = 1;
/**
* Generates a stri... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/getFolderStructure.ts | packages/core/src/utils/getFolderStructure.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs/promises';
import type { Dirent } from 'node:fs';
import * as path from 'node:path';
import { getErrorMessage, isNodeError } from './errors.js';
import type {
FileDiscoveryService,
FilterFilesOption... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/googleQuotaErrors.ts | packages/core/src/utils/googleQuotaErrors.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {
ErrorInfo,
GoogleApiError,
QuotaFailure,
RetryInfo,
} from './googleErrors.js';
import { parseGoogleApiError } from './googleErrors.js';
import { getErrorStatus, ModelNotFoundError } from './httpErrors.js';
/... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/retry.test.ts | packages/core/src/utils/retry.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { ApiError } from '@google/genai';
import { AuthType } from '../core/contentGenerator.js';
imp... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/schemaValidator.ts | packages/core/src/utils/schemaValidator.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import AjvPkg from 'ajv';
import * as addFormats from 'ajv-formats';
// Ajv's ESM/CJS interop: use 'any' for compatibility as recommended by Ajv docs
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const AjvClass = (... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/channel.ts | packages/core/src/utils/channel.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { getPackageJson } from './package.js';
export enum ReleaseChannel {
NIGHTLY = 'nightly',
PREVIEW = 'preview',
STABLE = 'stable',
}
const cache = new Map<string, ReleaseChannel>();
/**
* Clears the cache for testin... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/shell-utils.ts | packages/core/src/utils/shell-utils.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import os from 'node:os';
import { quote } from 'shell-quote';
import {
spawn,
spawnSync,
type SpawnOptionsWithoutStdio,
} from 'node:child_process';
import type { Node } from 'web-tree-sitter';
import { Language, Parser, Que... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/editCorrector.ts | packages/core/src/utils/editCorrector.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Content } from '@google/genai';
import type { GeminiClient } from '../core/client.js';
import type { BaseLlmClient } from '../core/baseLlmClient.js';
import type { EditToolParams } from '../tools/edit.js';
import {
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/paths.ts | packages/core/src/utils/paths.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import path from 'node:path';
import os from 'node:os';
import * as crypto from 'node:crypto';
export const GEMINI_DIR = '.gemini';
export const GOOGLE_ACCOUNTS_FILENAME = 'google_accounts.json';
/**
* Special characters that ne... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/memoryDiscovery.ts | packages/core/src/utils/memoryDiscovery.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs/promises';
import * as fsSync from 'node:fs';
import * as path from 'node:path';
import { homedir } from 'node:os';
import { bfsFileSearch } from './bfsFileSearch.js';
import { getAllGeminiMdFilenames }... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/tool-utils.test.ts | packages/core/src/utils/tool-utils.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { expect, describe, it } from 'vitest';
import { doesToolInvocationMatch, getToolSuggestion } from './tool-utils.js';
import type { AnyToolInvocation, Config } from '../index.js';
import { ReadFileTool } from '../tools/read-... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/httpErrors.ts | packages/core/src/utils/httpErrors.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export interface HttpError extends Error {
status?: number;
}
/**
* Extracts the HTTP status code from an error object.
* @param error The error object.
* @returns The HTTP status code, or undefined if not found.
*/
export f... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/formatters.test.ts | packages/core/src/utils/formatters.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { bytesToMB, formatMemoryUsage } from './formatters.js';
describe('bytesToMB', () => {
it('converts bytes to megabytes', () => {
expect(bytesToMB(0)).toBe(0);
expect... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/editor.test.ts | packages/core/src/utils/editor.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
vi,
describe,
it,
expect,
beforeEach,
afterEach,
type Mock,
} from 'vitest';
import {
checkHasEditorType,
getDiffCommand,
openDiff,
allowEditorTypeInSandbox,
isEditorAvailable,
type EditorType,
} ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/bfsFileSearch.test.ts | packages/core/src/utils/bfsFileSearch.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import * as fsPromises from 'node:fs/promises';
import * as path from 'node:path';
import * as os from 'node:os';
import { bfsFileSearch, bfsFileSearchSync } fro... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/errorReporting.test.ts | packages/core/src/utils/errorReporting.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import { reportError } from './errorReporting.js';
import { debugL... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/googleQuotaErrors.test.ts | packages/core/src/utils/googleQuotaErrors.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, afterEach } from 'vitest';
import {
classifyGoogleError,
RetryableQuotaError,
TerminalQuotaError,
} from './googleQuotaErrors.js';
import * as errorParser from './googleErrors.js';
import ty... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/environmentContext.test.ts | packages/core/src/utils/environmentContext.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
describe,
it,
expect,
vi,
beforeEach,
afterEach,
type Mock,
} from 'vitest';
import {
getEnvironmentContext,
getDirectoryContextString,
} from './environmentContext.js';
import type { Config } from '../co... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/secure-browser-launcher.test.ts | packages/core/src/utils/secure-browser-launcher.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { openBrowserSecurely } from './secure-browser-launcher.js';
// Create mock function using vi.hoisted
const mockExecFile = vi.hoisted(() => vi.fn());... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/generateContentResponseUtilities.test.ts | packages/core/src/utils/generateContentResponseUtilities.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import {
getResponseTextFromParts,
getFunctionCalls,
getFunctionCallsFromParts,
getFunctionCallsAsJson,
getFunctionCallsFromPartsAsJson,
getStructuredResponse,
getStructu... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/userAccountManager.test.ts | packages/core/src/utils/userAccountManager.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Mock } from 'vitest';
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import { UserAccountManager } from './userAccountManager.js';
import * as fs from 'node:fs';
import * as os from 'node:os... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/ignorePatterns.test.ts | packages/core/src/utils/ignorePatterns.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi } from 'vitest';
import {
FileExclusions,
BINARY_EXTENSIONS,
extractExtensionsFromPatterns,
} from './ignorePatterns.js';
import type { Config } from '../config/config.js';
// Mock the memor... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/errorParsing.test.ts | packages/core/src/utils/errorParsing.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { parseAndFormatApiError } from './errorParsing.js';
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
import { AuthType } from '../core/contentGenerator.js';
im... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/flashFallback.test.ts | packages/core/src/utils/flashFallback.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { Config } from '../config/config.js';
import fs from 'node:fs';
import {
setSimulate429,
disableSimulationAfterFallback,
shouldSimulate429,
resetRequest... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/pathReader.test.ts | packages/core/src/utils/pathReader.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, afterEach, vi } from 'vitest';
import mock from 'mock-fs';
import * as path from 'node:path';
import { WorkspaceContext } from './workspaceContext.js';
import { readPathFromWorkspace } from './pathRea... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/version.ts | packages/core/src/utils/version.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { getPackageJson } from './package.js';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export async fu... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/geminiIgnoreParser.ts | packages/core/src/utils/geminiIgnoreParser.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs';
import * as path from 'node:path';
import ignore from 'ignore';
export interface GeminiIgnoreFilter {
isIgnored(filePath: string): boolean;
getPatterns(): string[];
getIgnoreFilePath(): string ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/pathReader.ts | packages/core/src/utils/pathReader.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { promises as fs } from 'node:fs';
import path from 'node:path';
import { glob } from 'glob';
import type { PartUnion } from '@google/genai';
import { processSingleFileContent } from './fileUtils.js';
import type { Config } ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/gitIgnoreParser.test.ts | packages/core/src/utils/gitIgnoreParser.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { GitIgnoreParser } from './gitIgnoreParser.js';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import * as os from 'node:os';... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/workspaceContext.test.ts | packages/core/src/utils/workspaceContext.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import { WorkspaceContext } from './workspaceContext.js';
im... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/tokenCalculation.test.ts | packages/core/src/utils/tokenCalculation.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi } from 'vitest';
import { calculateRequestTokenCount } from './tokenCalculation.js';
import type { ContentGenerator } from '../core/contentGenerator.js';
describe('calculateRequestTokenCount', () ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/thoughtUtils.ts | packages/core/src/utils/thoughtUtils.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export type ThoughtSummary = {
subject: string;
description: string;
};
const START_DELIMITER = '**';
const END_DELIMITER = '**';
/**
* Parses a raw thought string into a structured ThoughtSummary object.
*
* Thoughts are ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/pathCorrector.ts | packages/core/src/utils/pathCorrector.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs';
import * as path from 'node:path';
import type { Config } from '../config/config.js';
import { bfsFileSearchSync } from './bfsFileSearch.js';
type SuccessfulPathCorrection = {
success: true;
corr... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/errorReporting.ts | packages/core/src/utils/errorReporting.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import type { Content } from '@google/genai';
import { debugLogger } from './debugLogger.js';
interface ErrorReportData {
error: { messag... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/terminalSerializer.test.ts | packages/core/src/utils/terminalSerializer.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { Terminal } from '@xterm/headless';
import {
serializeTerminalToObject,
convertColorToHex,
ColorMode,
} from './terminalSerializer.js';
const RED_FG = '\x1b[31m';
const ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/partUtils.ts | packages/core/src/utils/partUtils.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {
GenerateContentResponse,
PartListUnion,
Part,
PartUnion,
} from '@google/genai';
/**
* Converts a PartListUnion into a string.
* If verbose is true, includes summary representations of non-text parts.
*/
e... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/textUtils.ts | packages/core/src/utils/textUtils.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Safely replaces text with literal strings, avoiding ECMAScript GetSubstitution issues.
* Escapes $ characters to prevent template interpretation.
*/
export function safeLiteralReplace(
str: string,
oldString: string,
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/geminiIgnoreParser.test.ts | packages/core/src/utils/geminiIgnoreParser.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import { GeminiIgnoreParser } from './geminiIgnoreParser.js';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import * as os from ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/tokenCalculation.ts | packages/core/src/utils/tokenCalculation.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { PartListUnion, Part } from '@google/genai';
import type { ContentGenerator } from '../core/contentGenerator.js';
// Token estimation constants
// ASCII characters (0-127) are roughly 4 chars per token
const ASCII_TOK... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/thoughtUtils.test.ts | packages/core/src/utils/thoughtUtils.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { parseThought } from './thoughtUtils.js';
describe('parseThought', () => {
it.each([
{
name: 'a standard thought with subject and description',
rawText: '**S... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/memoryDiscovery.test.ts | packages/core/src/utils/memoryDiscovery.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import * as fsPromises from 'node:fs/promises';
import * as os from 'node:os';
import * as path from 'node:path';
import {
loadServerHierarchicalMemory,
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/stdio.test.ts | packages/core/src/utils/stdio.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { patchStdio, createWorkingStdio } from './stdio.js';
import { coreEvents } from './events.js';
vi.mock('./events.js', () => ({
coreEvents: {
e... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/safeJsonStringify.test.ts | packages/core/src/utils/safeJsonStringify.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { safeJsonStringify } from './safeJsonStringify.js';
describe('safeJsonStringify', () => {
it('should stringify normal objects without issues', () => {
const obj = { name... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/editCorrector.test.ts | packages/core/src/utils/editCorrector.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { Mock } from 'vitest';
import { vi, describe, it, expect, beforeEach, type Mocked } from 'vitest';
import * as fs from 'node:fs';
import { EDIT_TOOL_NAME } from '... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/getFolderStructure.test.ts | packages/core/src/utils/getFolderStructure.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import fsPromises from 'node:fs/promises';
import * as nodePath from 'node:path';
import * as os from 'node:os';
import { getFolderStructure } from './getFolderS... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/memoryImportProcessor.ts | packages/core/src/utils/memoryImportProcessor.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import { isSubpath } from './paths.js';
import { marked, type Token } from 'marked';
import { debugLogger } from './debugLogger.js';
// Simple console logg... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/packages/core/src/utils/getPty.ts | packages/core/src/utils/getPty.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export type PtyImplementation = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
module: any;
name: 'lydell-node-pty' | 'node-pty';
} | null;
export interface PtyProcess {
readonly pid: number;
onData(cal... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.