chore: consistently import node modules with prefix (#3013)

Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Pascal Birchler 2025-08-25 22:11:27 +02:00 committed by GitHub
parent 415d3413c4
commit ee4feea006
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
168 changed files with 420 additions and 405 deletions

View file

@ -15,10 +15,10 @@ The following is an example of a proxy script that can be used with the `GEMINI_
// Set `GEMINI_SANDBOX_PROXY_COMMAND=scripts/example-proxy.js` to run proxy alongside sandbox // Set `GEMINI_SANDBOX_PROXY_COMMAND=scripts/example-proxy.js` to run proxy alongside sandbox
// Test via `curl https://example.com` inside sandbox (in shell mode or via shell tool) // Test via `curl https://example.com` inside sandbox (in shell mode or via shell tool)
import http from 'http'; import http from 'node:http';
import net from 'net'; import net from 'node:net';
import { URL } from 'url'; import { URL } from 'node:url';
import console from 'console'; import console from 'node:console';
const PROXY_PORT = 8877; const PROXY_PORT = 8877;
const ALLOWED_DOMAINS = ['example.com', 'googleapis.com']; const ALLOWED_DOMAINS = ['example.com', 'googleapis.com'];

View file

@ -5,9 +5,9 @@
*/ */
import esbuild from 'esbuild'; import esbuild from 'esbuild';
import path from 'path'; import path from 'node:path';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'node:url';
import { createRequire } from 'module'; import { createRequire } from 'node:module';
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename); const __dirname = path.dirname(__filename);

View file

@ -13,7 +13,7 @@ import importPlugin from 'eslint-plugin-import';
import vitest from '@vitest/eslint-plugin'; import vitest from '@vitest/eslint-plugin';
import globals from 'globals'; import globals from 'globals';
import licenseHeader from 'eslint-plugin-license-header'; import licenseHeader from 'eslint-plugin-license-header';
import path from 'node:path'; // Use node: prefix for built-ins import path from 'node:path';
import url from 'node:url'; import url from 'node:url';
// --- ESM way to get __dirname --- // --- ESM way to get __dirname ---
@ -175,6 +175,7 @@ export default tseslint.config(
files: ['./**/*.{tsx,ts,js}'], files: ['./**/*.{tsx,ts,js}'],
plugins: { plugins: {
'license-header': licenseHeader, 'license-header': licenseHeader,
import: importPlugin,
}, },
rules: { rules: {
'license-header/header': [ 'license-header/header': [
@ -187,6 +188,7 @@ export default tseslint.config(
' */', ' */',
], ],
], ],
'import/enforce-node-protocol-usage': ['error', 'always'],
}, },
}, },
// extra settings for scripts that we run directly with node // extra settings for scripts that we run directly with node

View file

@ -9,10 +9,17 @@ if (process.env.NO_COLOR !== undefined) {
delete process.env.NO_COLOR; delete process.env.NO_COLOR;
} }
import { mkdir, readdir, rm, readFile, writeFile, unlink } from 'fs/promises'; import {
import { join, dirname } from 'path'; mkdir,
import { fileURLToPath } from 'url'; readdir,
import * as os from 'os'; rm,
readFile,
writeFile,
unlink,
} from 'node:fs/promises';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import * as os from 'node:os';
import { import {
GEMINI_CONFIG_DIR, GEMINI_CONFIG_DIR,

View file

@ -6,8 +6,8 @@
import { describe, it, expect } from 'vitest'; import { describe, it, expect } from 'vitest';
import { TestRig, printDebugInfo, validateModelOutput } from './test-helper.js'; import { TestRig, printDebugInfo, validateModelOutput } from './test-helper.js';
import { existsSync } from 'fs'; import { existsSync } from 'node:fs';
import { join } from 'path'; import { join } from 'node:path';
describe('list_directory', () => { describe('list_directory', () => {
it('should be able to list a directory', async () => { it('should be able to list a directory', async () => {

View file

@ -11,8 +11,8 @@
import { describe, it, beforeAll, expect } from 'vitest'; import { describe, it, beforeAll, expect } from 'vitest';
import { TestRig } from './test-helper.js'; import { TestRig } from './test-helper.js';
import { join } from 'path'; import { join } from 'node:path';
import { writeFileSync } from 'fs'; import { writeFileSync } from 'node:fs';
// Create a minimal MCP server that doesn't require external dependencies // Create a minimal MCP server that doesn't require external dependencies
// This implements the MCP protocol directly using Node.js built-ins // This implements the MCP protocol directly using Node.js built-ins
@ -175,7 +175,7 @@ describe('mcp server with cyclic tool schema is detected', () => {
// Make the script executable (though running with 'node' should work anyway) // Make the script executable (though running with 'node' should work anyway)
if (process.platform !== 'win32') { if (process.platform !== 'win32') {
const { chmodSync } = await import('fs'); const { chmodSync } = await import('node:fs');
chmodSync(testServerPath, 0o755); chmodSync(testServerPath, 0o755);
} }
}); });

View file

@ -6,8 +6,8 @@
import { describe, it, expect, beforeAll } from 'vitest'; import { describe, it, expect, beforeAll } from 'vitest';
import { ShellExecutionService } from '../packages/core/src/services/shellExecutionService.js'; import { ShellExecutionService } from '../packages/core/src/services/shellExecutionService.js';
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as path from 'path'; import * as path from 'node:path';
import { vi } from 'vitest'; import { vi } from 'vitest';
describe('ShellExecutionService programmatic integration tests', () => { describe('ShellExecutionService programmatic integration tests', () => {

View file

@ -12,8 +12,8 @@
import { describe, it, beforeAll, expect } from 'vitest'; import { describe, it, beforeAll, expect } from 'vitest';
import { TestRig, validateModelOutput } from './test-helper.js'; import { TestRig, validateModelOutput } from './test-helper.js';
import { join } from 'path'; import { join } from 'node:path';
import { writeFileSync } from 'fs'; import { writeFileSync } from 'node:fs';
// Create a minimal MCP server that doesn't require external dependencies // Create a minimal MCP server that doesn't require external dependencies
// This implements the MCP protocol directly using Node.js built-ins // This implements the MCP protocol directly using Node.js built-ins
@ -186,7 +186,7 @@ describe('simple-mcp-server', () => {
// Make the script executable (though running with 'node' should work anyway) // Make the script executable (though running with 'node' should work anyway)
if (process.platform !== 'win32') { if (process.platform !== 'win32') {
const { chmodSync } = await import('fs'); const { chmodSync } = await import('node:fs');
chmodSync(testServerPath, 0o755); chmodSync(testServerPath, 0o755);
} }
}); });

View file

@ -4,13 +4,13 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { execSync, spawn } from 'child_process'; import { execSync, spawn } from 'node:child_process';
import { parse } from 'shell-quote'; import { parse } from 'shell-quote';
import { mkdirSync, writeFileSync, readFileSync } from 'fs'; import { mkdirSync, writeFileSync, readFileSync } from 'node:fs';
import { join, dirname } from 'path'; import { join, dirname } from 'node:path';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'node:url';
import { env } from 'process'; import { env } from 'node:process';
import fs from 'fs'; import fs from 'node:fs';
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));

View file

@ -5,9 +5,9 @@
*/ */
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest'; import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import { tmpdir } from 'os'; import { tmpdir } from 'node:os';
import { import {
Config, Config,
ConfigParameters, ConfigParameters,

View file

@ -5,8 +5,8 @@
*/ */
import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest';
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'path'; import * as path from 'node:path';
import { ShellTool, EditTool, WriteFileTool } from '@google/gemini-cli-core'; import { ShellTool, EditTool, WriteFileTool } from '@google/gemini-cli-core';
import { loadCliConfig, parseArguments, CliArgs } from './config.js'; import { loadCliConfig, parseArguments, CliArgs } from './config.js';
import { Settings } from './settings.js'; import { Settings } from './settings.js';
@ -20,7 +20,7 @@ vi.mock('./trustedFolders.js', () => ({
vi.mock('fs', async (importOriginal) => { vi.mock('fs', async (importOriginal) => {
const actualFs = await importOriginal<typeof import('fs')>(); const actualFs = await importOriginal<typeof import('fs')>();
const pathMod = await import('path'); const pathMod = await import('node:path');
const mockHome = '/mock/home/user'; const mockHome = '/mock/home/user';
const MOCK_CWD1 = process.cwd(); const MOCK_CWD1 = process.cwd();
const MOCK_CWD2 = pathMod.resolve(pathMod.sep, 'home', 'user', 'project'); const MOCK_CWD2 = pathMod.resolve(pathMod.sep, 'home', 'user', 'project');

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import { homedir } from 'node:os'; import { homedir } from 'node:os';
import yargs from 'yargs/yargs'; import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers'; import { hideBin } from 'yargs/helpers';

View file

@ -5,9 +5,9 @@
*/ */
import { vi } from 'vitest'; import { vi } from 'vitest';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'path'; import * as path from 'node:path';
import { import {
EXTENSIONS_CONFIG_FILENAME, EXTENSIONS_CONFIG_FILENAME,
INSTALL_METADATA_FILENAME, INSTALL_METADATA_FILENAME,
@ -17,7 +17,7 @@ import {
uninstallExtension, uninstallExtension,
updateExtension, updateExtension,
} from './extension.js'; } from './extension.js';
import { execSync } from 'child_process'; import { execSync } from 'node:child_process';
import { SimpleGit, simpleGit } from 'simple-git'; import { SimpleGit, simpleGit } from 'simple-git';
vi.mock('simple-git', () => ({ vi.mock('simple-git', () => ({

View file

@ -9,9 +9,9 @@ import {
GeminiCLIExtension, GeminiCLIExtension,
Storage, Storage,
} from '@google/gemini-cli-core'; } from '@google/gemini-cli-core';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import * as os from 'os'; import * as os from 'node:os';
import { simpleGit } from 'simple-git'; import { simpleGit } from 'simple-git';
export const EXTENSIONS_DIRECTORY_NAME = '.gemini/extensions'; export const EXTENSIONS_DIRECTORY_NAME = '.gemini/extensions';

View file

@ -7,7 +7,7 @@
/// <reference types="vitest/globals" /> /// <reference types="vitest/globals" />
// Mock 'os' first. // Mock 'os' first.
import * as osActual from 'os'; // Import for type info for the mock factory import * as osActual from 'node:os'; // Import for type info for the mock factory
vi.mock('os', async (importOriginal) => { vi.mock('os', async (importOriginal) => {
const actualOs = await importOriginal<typeof osActual>(); const actualOs = await importOriginal<typeof osActual>();
return { return {
@ -33,7 +33,7 @@ vi.mock('./trustedFolders.js', () => ({
})); }));
// NOW import everything else, including the (now effectively re-exported) settings.js // NOW import everything else, including the (now effectively re-exported) settings.js
import * as pathActual from 'path'; // Restored for MOCK_WORKSPACE_SETTINGS_PATH import * as pathActual from 'node:path'; // Restored for MOCK_WORKSPACE_SETTINGS_PATH
import { import {
describe, describe,
it, it,
@ -44,7 +44,7 @@ import {
type Mocked, type Mocked,
type Mock, type Mock,
} from 'vitest'; } from 'vitest';
import * as fs from 'fs'; // fs will be mocked separately import * as fs from 'node:fs'; // fs will be mocked separately
import stripJsonComments from 'strip-json-comments'; // Will be mocked separately import stripJsonComments from 'strip-json-comments'; // Will be mocked separately
import { isWorkspaceTrusted } from './trustedFolders.js'; import { isWorkspaceTrusted } from './trustedFolders.js';

View file

@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import { homedir, platform } from 'os'; import { homedir, platform } from 'node:os';
import * as dotenv from 'dotenv'; import * as dotenv from 'dotenv';
import { import {
GEMINI_CONFIG_DIR as GEMINI_DIR, GEMINI_CONFIG_DIR as GEMINI_DIR,

View file

@ -5,7 +5,7 @@
*/ */
// Mock 'os' first. // Mock 'os' first.
import * as osActual from 'os'; import * as osActual from 'node:os';
vi.mock('os', async (importOriginal) => { vi.mock('os', async (importOriginal) => {
const actualOs = await importOriginal<typeof osActual>(); const actualOs = await importOriginal<typeof osActual>();
return { return {
@ -25,9 +25,9 @@ import {
type Mocked, type Mocked,
type Mock, type Mock,
} from 'vitest'; } from 'vitest';
import * as fs from 'fs'; import * as fs from 'node:fs';
import stripJsonComments from 'strip-json-comments'; import stripJsonComments from 'strip-json-comments';
import * as path from 'path'; import * as path from 'node:path';
import { import {
loadTrustedFolders, loadTrustedFolders,

View file

@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import { homedir } from 'os'; import { homedir } from 'node:os';
import { getErrorMessage, isWithinRoot } from '@google/gemini-cli-core'; import { getErrorMessage, isWithinRoot } from '@google/gemini-cli-core';
import { Settings } from './settings.js'; import { Settings } from './settings.js';
import stripJsonComments from 'strip-json-comments'; import stripJsonComments from 'strip-json-comments';

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { promises as fs } from 'fs'; import { promises as fs } from 'node:fs';
import path from 'path'; import path from 'node:path';
import toml from '@iarna/toml'; import toml from '@iarna/toml';
import { glob } from 'glob'; import { glob } from 'glob';
import { z } from 'zod'; import { z } from 'zod';

View file

@ -9,7 +9,7 @@ import { ConfirmationRequiredError, ShellProcessor } from './shellProcessor.js';
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
import { CommandContext } from '../../ui/commands/types.js'; import { CommandContext } from '../../ui/commands/types.js';
import { ApprovalMode, Config } from '@google/gemini-cli-core'; import { ApprovalMode, Config } from '@google/gemini-cli-core';
import os from 'os'; import os from 'node:os';
import { quote } from 'shell-quote'; import { quote } from 'shell-quote';
// Helper function to determine the expected escaped string based on the current OS, // Helper function to determine the expected escaped string based on the current OS,

View file

@ -25,7 +25,7 @@ import { useConsoleMessages } from './hooks/useConsoleMessages.js';
import { StreamingState, ConsoleMessageItem } from './types.js'; import { StreamingState, ConsoleMessageItem } from './types.js';
import { Tips } from './components/Tips.js'; import { Tips } from './components/Tips.js';
import { checkForUpdates, UpdateObject } from './utils/updateCheck.js'; import { checkForUpdates, UpdateObject } from './utils/updateCheck.js';
import { EventEmitter } from 'events'; import { EventEmitter } from 'node:events';
import { updateEventEmitter } from '../utils/updateEventEmitter.js'; import { updateEventEmitter } from '../utils/updateEventEmitter.js';
import * as auth from '../config/auth.js'; import * as auth from '../config/auth.js';
import * as useTerminalSize from './hooks/useTerminalSize.js'; import * as useTerminalSize from './hooks/useTerminalSize.js';

View file

@ -84,7 +84,7 @@ import { useKeypress, Key } from './hooks/useKeypress.js';
import { KeypressProvider } from './contexts/KeypressContext.js'; import { KeypressProvider } from './contexts/KeypressContext.js';
import { useKittyKeyboardProtocol } from './hooks/useKittyKeyboardProtocol.js'; import { useKittyKeyboardProtocol } from './hooks/useKittyKeyboardProtocol.js';
import { keyMatchers, Command } from './keyMatchers.js'; import { keyMatchers, Command } from './keyMatchers.js';
import * as fs from 'fs'; import * as fs from 'node:fs';
import { UpdateNotification } from './components/UpdateNotification.js'; import { UpdateNotification } from './components/UpdateNotification.js';
import { import {
isProQuotaExceededError, isProQuotaExceededError,

View file

@ -23,9 +23,9 @@ import { createMockCommandContext } from '../../test-utils/mockCommandContext.js
import { Content } from '@google/genai'; import { Content } from '@google/genai';
import { GeminiClient } from '@google/gemini-cli-core'; import { GeminiClient } from '@google/gemini-cli-core';
import * as fsPromises from 'fs/promises'; import * as fsPromises from 'node:fs/promises';
import { chatCommand } from './chatCommand.js'; import { chatCommand } from './chatCommand.js';
import { Stats } from 'fs'; import { Stats } from 'node:fs';
import { HistoryItemWithoutId } from '../types.js'; import { HistoryItemWithoutId } from '../types.js';
vi.mock('fs/promises', () => ({ vi.mock('fs/promises', () => ({

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as fsPromises from 'fs/promises'; import * as fsPromises from 'node:fs/promises';
import React from 'react'; import React from 'react';
import { Text } from 'ink'; import { Text } from 'ink';
import { Colors } from '../colors.js'; import { Colors } from '../colors.js';
@ -16,7 +16,7 @@ import {
SlashCommandActionReturn, SlashCommandActionReturn,
} from './types.js'; } from './types.js';
import { decodeTagName } from '@google/gemini-cli-core'; import { decodeTagName } from '@google/gemini-cli-core';
import path from 'path'; import path from 'node:path';
import { HistoryItemWithoutId, MessageType } from '../types.js'; import { HistoryItemWithoutId, MessageType } from '../types.js';
interface ChatDetail { interface ChatDetail {

View file

@ -9,8 +9,8 @@ import { directoryCommand, expandHomeDir } from './directoryCommand.js';
import { Config, WorkspaceContext } from '@google/gemini-cli-core'; import { Config, WorkspaceContext } from '@google/gemini-cli-core';
import { CommandContext } from './types.js'; import { CommandContext } from './types.js';
import { MessageType } from '../types.js'; import { MessageType } from '../types.js';
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'path'; import * as path from 'node:path';
describe('directoryCommand', () => { describe('directoryCommand', () => {
let mockContext: CommandContext; let mockContext: CommandContext;

View file

@ -6,8 +6,8 @@
import { SlashCommand, CommandContext, CommandKind } from './types.js'; import { SlashCommand, CommandContext, CommandKind } from './types.js';
import { MessageType } from '../types.js'; import { MessageType } from '../types.js';
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'path'; import * as path from 'node:path';
import { loadServerHierarchicalMemory } from '@google/gemini-cli-core'; import { loadServerHierarchicalMemory } from '@google/gemini-cli-core';
export function expandHomeDir(p: string): string { export function expandHomeDir(p: string): string {

View file

@ -5,8 +5,8 @@
*/ */
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import { initCommand } from './initCommand.js'; import { initCommand } from './initCommand.js';
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
import { type CommandContext } from './types.js'; import { type CommandContext } from './types.js';

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import { import {
CommandContext, CommandContext,
SlashCommand, SlashCommand,

View file

@ -5,9 +5,9 @@
*/ */
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'path'; import * as path from 'node:path';
import { restoreCommand } from './restoreCommand.js'; import { restoreCommand } from './restoreCommand.js';
import { type CommandContext } from './types.js'; import { type CommandContext } from './types.js';
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import path from 'path'; import path from 'node:path';
import { import {
type CommandContext, type CommandContext,
type SlashCommand, type SlashCommand,

View file

@ -8,7 +8,7 @@ import { renderWithProviders } from '../../test-utils/render.js';
import { waitFor } from '@testing-library/react'; import { waitFor } from '@testing-library/react';
import { vi } from 'vitest'; import { vi } from 'vitest';
import { FolderTrustDialog, FolderTrustChoice } from './FolderTrustDialog.js'; import { FolderTrustDialog, FolderTrustChoice } from './FolderTrustDialog.js';
import * as process from 'process'; import * as process from 'node:process';
vi.mock('process', async () => { vi.mock('process', async () => {
const actual = await vi.importActual('process'); const actual = await vi.importActual('process');

View file

@ -12,7 +12,7 @@ import {
RadioSelectItem, RadioSelectItem,
} from './shared/RadioButtonSelect.js'; } from './shared/RadioButtonSelect.js';
import { useKeypress } from '../hooks/useKeypress.js'; import { useKeypress } from '../hooks/useKeypress.js';
import * as process from 'process'; import * as process from 'node:process';
export enum FolderTrustChoice { export enum FolderTrustChoice {
TRUST_FOLDER = 'trust_folder', TRUST_FOLDER = 'trust_folder',

View file

@ -9,7 +9,7 @@ import { waitFor } from '@testing-library/react';
import { InputPrompt, InputPromptProps } from './InputPrompt.js'; import { InputPrompt, InputPromptProps } from './InputPrompt.js';
import type { TextBuffer } from './shared/text-buffer.js'; import type { TextBuffer } from './shared/text-buffer.js';
import { Config } from '@google/gemini-cli-core'; import { Config } from '@google/gemini-cli-core';
import * as path from 'path'; import * as path from 'node:path';
import { import {
CommandContext, CommandContext,
SlashCommand, SlashCommand,

View file

@ -25,7 +25,7 @@ import {
saveClipboardImage, saveClipboardImage,
cleanupOldClipboardImages, cleanupOldClipboardImages,
} from '../utils/clipboardUtils.js'; } from '../utils/clipboardUtils.js';
import * as path from 'path'; import * as path from 'node:path';
import { SCREEN_READER_USER_PREFIX } from '../constants.js'; import { SCREEN_READER_USER_PREFIX } from '../constants.js';
export interface InputPromptProps { export interface InputPromptProps {

View file

@ -9,7 +9,7 @@ import { render } from 'ink-testing-library';
import { DiffRenderer } from './DiffRenderer.js'; import { DiffRenderer } from './DiffRenderer.js';
import * as CodeColorizer from '../../utils/CodeColorizer.js'; import * as CodeColorizer from '../../utils/CodeColorizer.js';
import { vi } from 'vitest'; import { vi } from 'vitest';
import { EOL } from 'os'; import { EOL } from 'node:os';
describe('<OverflowProvider><DiffRenderer /></OverflowProvider>', () => { describe('<OverflowProvider><DiffRenderer /></OverflowProvider>', () => {
const mockColorizeCode = vi.spyOn(CodeColorizer, 'colorizeCode'); const mockColorizeCode = vi.spyOn(CodeColorizer, 'colorizeCode');

View file

@ -6,9 +6,9 @@
import React from 'react'; import React from 'react';
import { Box, Text } from 'ink'; import { Box, Text } from 'ink';
import { EOL } from 'os'; import { EOL } from 'node:os';
import { Colors } from '../../colors.js'; import { Colors } from '../../colors.js';
import crypto from 'crypto'; import crypto from 'node:crypto';
import { colorizeCode, colorizeLine } from '../../utils/CodeColorizer.js'; import { colorizeCode, colorizeLine } from '../../utils/CodeColorizer.js';
import { MaxSizedBox } from '../shared/MaxSizedBox.js'; import { MaxSizedBox } from '../shared/MaxSizedBox.js';
import { theme } from '../../semantic-colors.js'; import { theme } from '../../semantic-colors.js';

View file

@ -4,10 +4,10 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { spawnSync } from 'child_process'; import { spawnSync } from 'node:child_process';
import fs from 'fs'; import fs from 'node:fs';
import os from 'os'; import os from 'node:os';
import pathMod from 'path'; import pathMod from 'node:path';
import { useState, useCallback, useEffect, useMemo, useReducer } from 'react'; import { useState, useCallback, useEffect, useMemo, useReducer } from 'react';
import stringWidth from 'string-width'; import stringWidth from 'string-width';
import { unescapePath } from '@google/gemini-cli-core'; import { unescapePath } from '@google/gemini-cli-core';

View file

@ -13,7 +13,7 @@ import {
Key, Key,
} from './KeypressContext.js'; } from './KeypressContext.js';
import { useStdin } from 'ink'; import { useStdin } from 'ink';
import { EventEmitter } from 'events'; import { EventEmitter } from 'node:events';
import { import {
KITTY_KEYCODE_ENTER, KITTY_KEYCODE_ENTER,
KITTY_KEYCODE_NUMPAD_ENTER, KITTY_KEYCODE_NUMPAD_ENTER,

View file

@ -17,8 +17,8 @@ import React, {
useEffect, useEffect,
useRef, useRef,
} from 'react'; } from 'react';
import readline from 'readline'; import readline from 'node:readline';
import { PassThrough } from 'stream'; import { PassThrough } from 'node:stream';
import { import {
BACKSLASH_ENTER_DETECTION_WINDOW_MS, BACKSLASH_ENTER_DETECTION_WINDOW_MS,
KITTY_CTRL_C, KITTY_CTRL_C,

View file

@ -16,11 +16,11 @@ import {
COMMON_IGNORE_PATTERNS, COMMON_IGNORE_PATTERNS,
DEFAULT_FILE_EXCLUDES, DEFAULT_FILE_EXCLUDES,
} from '@google/gemini-cli-core'; } from '@google/gemini-cli-core';
import * as os from 'os'; import * as os from 'node:os';
import { ToolCallStatus } from '../types.js'; import { ToolCallStatus } from '../types.js';
import { UseHistoryManagerReturn } from './useHistoryManager.js'; import { UseHistoryManagerReturn } from './useHistoryManager.js';
import * as fsPromises from 'fs/promises'; import * as fsPromises from 'node:fs/promises';
import * as path from 'path'; import * as path from 'node:path';
describe('handleAtCommand', () => { describe('handleAtCommand', () => {
let testRootDir: string; let testRootDir: string;

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as path from 'path'; import * as path from 'node:path';
import { PartListUnion, PartUnion } from '@google/genai'; import { PartListUnion, PartUnion } from '@google/genai';
import { import {
AnyToolInvocation, AnyToolInvocation,

View file

@ -36,10 +36,10 @@ import {
type ShellExecutionResult, type ShellExecutionResult,
type ShellOutputEvent, type ShellOutputEvent,
} from '@google/gemini-cli-core'; } from '@google/gemini-cli-core';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'path'; import * as path from 'node:path';
import * as crypto from 'crypto'; import * as crypto from 'node:crypto';
import { ToolCallStatus } from '../types.js'; import { ToolCallStatus } from '../types.js';
describe('useShellCommandProcessor', () => { describe('useShellCommandProcessor', () => {

View file

@ -21,10 +21,10 @@ import { type PartListUnion } from '@google/genai';
import { UseHistoryManagerReturn } from './useHistoryManager.js'; import { UseHistoryManagerReturn } from './useHistoryManager.js';
import { SHELL_COMMAND_NAME } from '../constants.js'; import { SHELL_COMMAND_NAME } from '../constants.js';
import { formatMemoryUsage } from '../utils/formatters.js'; import { formatMemoryUsage } from '../utils/formatters.js';
import crypto from 'crypto'; import crypto from 'node:crypto';
import path from 'path'; import path from 'node:path';
import os from 'os'; import os from 'node:os';
import fs from 'fs'; import fs from 'node:fs';
export const OUTPUT_UPDATE_INTERVAL_MS = 1000; export const OUTPUT_UPDATE_INTERVAL_MS = 1000;
const MAX_OUTPUT_LENGTH = 10000; const MAX_OUTPUT_LENGTH = 10000;

View file

@ -5,7 +5,7 @@
*/ */
import { renderHook, act } from '@testing-library/react'; import { renderHook, act } from '@testing-library/react';
import { EventEmitter } from 'events'; import { EventEmitter } from 'node:events';
import { useFocus } from './useFocus.js'; import { useFocus } from './useFocus.js';
import { vi } from 'vitest'; import { vi } from 'vitest';
import { useStdin, useStdout } from 'ink'; import { useStdin, useStdout } from 'ink';

View file

@ -13,7 +13,7 @@ import {
LoadedTrustedFolders, LoadedTrustedFolders,
TrustLevel, TrustLevel,
} from '../../config/trustedFolders.js'; } from '../../config/trustedFolders.js';
import * as process from 'process'; import * as process from 'node:process';
import * as trustedFolders from '../../config/trustedFolders.js'; import * as trustedFolders from '../../config/trustedFolders.js';

View file

@ -12,7 +12,7 @@ import {
TrustLevel, TrustLevel,
isWorkspaceTrusted, isWorkspaceTrusted,
} from '../../config/trustedFolders.js'; } from '../../config/trustedFolders.js';
import * as process from 'process'; import * as process from 'node:process';
export const useFolderTrust = ( export const useFolderTrust = (
settings: LoadedSettings, settings: LoadedSettings,

View file

@ -47,8 +47,8 @@ import { findLastSafeSplitPoint } from '../utils/markdownUtilities.js';
import { useStateAndRef } from './useStateAndRef.js'; import { useStateAndRef } from './useStateAndRef.js';
import { UseHistoryManagerReturn } from './useHistoryManager.js'; import { UseHistoryManagerReturn } from './useHistoryManager.js';
import { useLogger } from './useLogger.js'; import { useLogger } from './useLogger.js';
import { promises as fs } from 'fs'; import { promises as fs } from 'node:fs';
import path from 'path'; import path from 'node:path';
import { import {
useReactToolScheduler, useReactToolScheduler,
mapToDisplay as mapTrackedToolCallsToDisplay, mapToDisplay as mapTrackedToolCallsToDisplay,

View file

@ -8,7 +8,7 @@ import { useState, useEffect, useCallback } from 'react';
import { exec } from 'node:child_process'; import { exec } from 'node:child_process';
import fs from 'node:fs'; import fs from 'node:fs';
import fsPromises from 'node:fs/promises'; import fsPromises from 'node:fs/promises';
import path from 'path'; import path from 'node:path';
export function useGitBranchName(cwd: string): string | undefined { export function useGitBranchName(cwd: string): string | undefined {
const [branchName, setBranchName] = useState<string | undefined>(undefined); const [branchName, setBranchName] = useState<string | undefined>(undefined);

View file

@ -9,8 +9,8 @@ import { renderHook, act } from '@testing-library/react';
import { useKeypress, Key } from './useKeypress.js'; import { useKeypress, Key } from './useKeypress.js';
import { KeypressProvider } from '../contexts/KeypressContext.js'; import { KeypressProvider } from '../contexts/KeypressContext.js';
import { useStdin } from 'ink'; import { useStdin } from 'ink';
import { EventEmitter } from 'events'; import { EventEmitter } from 'node:events';
import { PassThrough } from 'stream'; import { PassThrough } from 'node:stream';
// Mock the 'ink' module to control stdin // Mock the 'ink' module to control stdin
vi.mock('ink', async (importOriginal) => { vi.mock('ink', async (importOriginal) => {

View file

@ -6,10 +6,10 @@
import { renderHook, act, waitFor } from '@testing-library/react'; import { renderHook, act, waitFor } from '@testing-library/react';
import { useShellHistory } from './useShellHistory.js'; import { useShellHistory } from './useShellHistory.js';
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as path from 'path'; import * as path from 'node:path';
import * as os from 'os'; import * as os from 'node:os';
import * as crypto from 'crypto'; import * as crypto from 'node:crypto';
vi.mock('fs/promises', () => ({ vi.mock('fs/promises', () => ({
readFile: vi.fn(), readFile: vi.fn(),

View file

@ -5,8 +5,8 @@
*/ */
import { useState, useEffect, useCallback } from 'react'; import { useState, useEffect, useCallback } from 'react';
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as path from 'path'; import * as path from 'node:path';
import { isNodeError, Storage } from '@google/gemini-cli-core'; import { isNodeError, Storage } from '@google/gemini-cli-core';
const MAX_HISTORY_LENGTH = 100; const MAX_HISTORY_LENGTH = 100;

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import util from 'util'; import util from 'node:util';
import { ConsoleMessageItem } from '../types.js'; import { ConsoleMessageItem } from '../types.js';
interface ConsolePatcherParams { interface ConsolePatcherParams {

View file

@ -9,7 +9,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import { MarkdownDisplay } from './MarkdownDisplay.js'; import { MarkdownDisplay } from './MarkdownDisplay.js';
import { LoadedSettings } from '../../config/settings.js'; import { LoadedSettings } from '../../config/settings.js';
import { SettingsContext } from '../contexts/SettingsContext.js'; import { SettingsContext } from '../contexts/SettingsContext.js';
import { EOL } from 'os'; import { EOL } from 'node:os';
describe('<MarkdownDisplay />', () => { describe('<MarkdownDisplay />', () => {
const baseProps = { const baseProps = {

View file

@ -6,7 +6,7 @@
import React from 'react'; import React from 'react';
import { Text, Box } from 'ink'; import { Text, Box } from 'ink';
import { EOL } from 'os'; import { EOL } from 'node:os';
import { Colors } from '../colors.js'; import { Colors } from '../colors.js';
import { colorizeCode } from './CodeColorizer.js'; import { colorizeCode } from './CodeColorizer.js';
import { TableRenderer } from './TableRenderer.js'; import { TableRenderer } from './TableRenderer.js';

View file

@ -4,10 +4,10 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { exec } from 'child_process'; import { exec } from 'node:child_process';
import { promisify } from 'util'; import { promisify } from 'node:util';
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as path from 'path'; import * as path from 'node:path';
const execAsync = promisify(exec); const execAsync = promisify(exec);

View file

@ -5,8 +5,8 @@
*/ */
import { vi, describe, it, expect, beforeEach, Mock } from 'vitest'; import { vi, describe, it, expect, beforeEach, Mock } from 'vitest';
import { spawn, SpawnOptions } from 'child_process'; import { spawn, SpawnOptions } from 'node:child_process';
import { EventEmitter } from 'events'; import { EventEmitter } from 'node:events';
import { import {
isAtCommand, isAtCommand,
isSlashCommand, isSlashCommand,
@ -44,7 +44,7 @@ describe('commandUtils', () => {
beforeEach(async () => { beforeEach(async () => {
vi.clearAllMocks(); vi.clearAllMocks();
// Dynamically import and set up spawn mock // Dynamically import and set up spawn mock
const { spawn } = await import('child_process'); const { spawn } = await import('node:child_process');
mockSpawn = spawn as Mock; mockSpawn = spawn as Mock;
// Create mock child process with stdout/stderr emitters // Create mock child process with stdout/stderr emitters

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { spawn, SpawnOptions } from 'child_process'; import { spawn, SpawnOptions } from 'node:child_process';
/** /**
* Checks if a query string potentially represents an '@' command. * Checks if a query string potentially represents an '@' command.

View file

@ -23,11 +23,11 @@
* to avoid conflicts with user customizations. * to avoid conflicts with user customizations.
*/ */
import { promises as fs } from 'fs'; import { promises as fs } from 'node:fs';
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'path'; import * as path from 'node:path';
import { exec } from 'child_process'; import { exec } from 'node:child_process';
import { promisify } from 'util'; import { promisify } from 'node:util';
import { isKittyProtocolEnabled } from './kittyProtocolDetector.js'; import { isKittyProtocolEnabled } from './kittyProtocolDetector.js';
import { VSCODE_SHIFT_ENTER_SEQUENCE } from './platformConstants.js'; import { VSCODE_SHIFT_ENTER_SEQUENCE } from './platformConstants.js';

View file

@ -5,7 +5,7 @@
*/ */
import stripAnsi from 'strip-ansi'; import stripAnsi from 'strip-ansi';
import { stripVTControlCharacters } from 'util'; import { stripVTControlCharacters } from 'node:util';
/** /**
* Calculates the maximum width of a multi-line ASCII art string. * Calculates the maximum width of a multi-line ASCII art string.

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { promises as fs } from 'fs'; import { promises as fs } from 'node:fs';
import { join } from 'path'; import { join } from 'node:path';
import { Storage } from '@google/gemini-cli-core'; import { Storage } from '@google/gemini-cli-core';
const cleanupFunctions: Array<(() => void) | (() => Promise<void>)> = []; const cleanupFunctions: Array<(() => void) | (() => Promise<void>)> = [];

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { EventEmitter } from 'events'; import { EventEmitter } from 'node:events';
export enum AppEvent { export enum AppEvent {
OpenDebugConsole = 'open-debug-console', OpenDebugConsole = 'open-debug-console',

View file

@ -5,7 +5,7 @@
*/ */
import { vi, describe, expect, it, afterEach, beforeEach } from 'vitest'; import { vi, describe, expect, it, afterEach, beforeEach } from 'vitest';
import * as child_process from 'child_process'; import * as child_process from 'node:child_process';
import { import {
isGitHubRepository, isGitHubRepository,
getGitRepoRoot, getGitRepoRoot,

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { execSync } from 'child_process'; import { execSync } from 'node:child_process';
import { ProxyAgent } from 'undici'; import { ProxyAgent } from 'undici';
/** /**

View file

@ -10,7 +10,7 @@ import { getInstallationInfo } from './installationInfo.js';
import { updateEventEmitter } from './updateEventEmitter.js'; import { updateEventEmitter } from './updateEventEmitter.js';
import { HistoryItem, MessageType } from '../ui/types.js'; import { HistoryItem, MessageType } from '../ui/types.js';
import { spawnWrapper } from './spawnWrapper.js'; import { spawnWrapper } from './spawnWrapper.js';
import { spawn } from 'child_process'; import { spawn } from 'node:child_process';
export function handleAutoUpdate( export function handleAutoUpdate(
info: UpdateObject | null, info: UpdateObject | null,

View file

@ -6,9 +6,9 @@
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import { getInstallationInfo, PackageManager } from './installationInfo.js'; import { getInstallationInfo, PackageManager } from './installationInfo.js';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import * as childProcess from 'child_process'; import * as childProcess from 'node:child_process';
import { isGitRepository } from '@google/gemini-cli-core'; import { isGitRepository } from '@google/gemini-cli-core';
vi.mock('@google/gemini-cli-core', () => ({ vi.mock('@google/gemini-cli-core', () => ({

View file

@ -5,9 +5,9 @@
*/ */
import { isGitRepository } from '@google/gemini-cli-core'; import { isGitRepository } from '@google/gemini-cli-core';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import * as childProcess from 'child_process'; import * as childProcess from 'node:child_process';
export enum PackageManager { export enum PackageManager {
NPM = 'npm', NPM = 'npm',

View file

@ -8,8 +8,8 @@ import {
readPackageUp, readPackageUp,
type PackageJson as BasePackageJson, type PackageJson as BasePackageJson,
} from 'read-package-up'; } from 'read-package-up';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'node:url';
import path from 'path'; import path from 'node:path';
export type PackageJson = BasePackageJson & { export type PackageJson = BasePackageJson & {
config?: { config?: {

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'path'; import * as path from 'node:path';
export function resolvePath(p: string): string { export function resolvePath(p: string): string {
if (!p) { if (!p) {

View file

@ -15,7 +15,7 @@ import {
USER_SETTINGS_DIR, USER_SETTINGS_DIR,
SETTINGS_DIRECTORY_NAME, SETTINGS_DIRECTORY_NAME,
} from '../config/settings.js'; } from '../config/settings.js';
import { promisify } from 'util'; import { promisify } from 'node:util';
import { Config, SandboxConfig } from '@google/gemini-cli-core'; import { Config, SandboxConfig } from '@google/gemini-cli-core';
import { ConsolePatcher } from '../ui/utils/ConsolePatcher.js'; import { ConsolePatcher } from '../ui/utils/ConsolePatcher.js';

View file

@ -4,6 +4,6 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { spawn } from 'child_process'; import { spawn } from 'node:child_process';
export const spawnWrapper = spawn; export const spawnWrapper = spawn;

View file

@ -6,7 +6,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest';
import { getStartupWarnings } from './startupWarnings.js'; import { getStartupWarnings } from './startupWarnings.js';
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import { getErrorMessage } from '@google/gemini-cli-core'; import { getErrorMessage } from '@google/gemini-cli-core';
vi.mock('fs/promises'); vi.mock('fs/promises');

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import fs from 'fs/promises'; import fs from 'node:fs/promises';
import os from 'os'; import os from 'node:os';
import { join as pathJoin } from 'node:path'; import { join as pathJoin } from 'node:path';
import { getErrorMessage } from '@google/gemini-cli-core'; import { getErrorMessage } from '@google/gemini-cli-core';

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { EventEmitter } from 'events'; import { EventEmitter } from 'node:events';
/** /**
* A shared event emitter for application-wide communication * A shared event emitter for application-wide communication

View file

@ -6,9 +6,9 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { getUserStartupWarnings } from './userStartupWarnings.js'; import { getUserStartupWarnings } from './userStartupWarnings.js';
import * as os from 'os'; import * as os from 'node:os';
import fs from 'fs/promises'; import fs from 'node:fs/promises';
import path from 'path'; import path from 'node:path';
// Mock os.homedir to control the home directory in tests // Mock os.homedir to control the home directory in tests
vi.mock('os', async (importOriginal) => { vi.mock('os', async (importOriginal) => {

View file

@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import fs from 'fs/promises'; import fs from 'node:fs/promises';
import * as os from 'os'; import * as os from 'node:os';
import path from 'path'; import path from 'node:path';
type WarningCheck = { type WarningCheck = {
id: string; id: string;

View file

@ -7,7 +7,7 @@
/* ACP defines a schema for a simple (experimental) JSON-RPC protocol that allows GUI applications to interact with agents. */ /* ACP defines a schema for a simple (experimental) JSON-RPC protocol that allows GUI applications to interact with agents. */
import { z } from 'zod'; import { z } from 'zod';
import { EOL } from 'os'; import { EOL } from 'node:os';
import * as schema from './schema.js'; import * as schema from './schema.js';
export * from './schema.js'; export * from './schema.js';

View file

@ -28,11 +28,11 @@ import { AcpFileSystemService } from './fileSystemService.js';
import { Readable, Writable } from 'node:stream'; import { Readable, Writable } from 'node:stream';
import { Content, Part, FunctionCall } from '@google/genai'; import { Content, Part, FunctionCall } from '@google/genai';
import { LoadedSettings, SettingScope } from '../config/settings.js'; import { LoadedSettings, SettingScope } from '../config/settings.js';
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as path from 'path'; import * as path from 'node:path';
import { z } from 'zod'; import { z } from 'zod';
import { randomUUID } from 'crypto'; import { randomUUID } from 'node:crypto';
import { Extension } from '../config/extension.js'; import { Extension } from '../config/extension.js';
import { CliArgs, loadCliConfig } from '../config/config.js'; import { CliArgs, loadCliConfig } from '../config/config.js';

View file

@ -13,12 +13,12 @@ import {
} from './oauth2.js'; } from './oauth2.js';
import { UserAccountManager } from '../utils/userAccountManager.js'; import { UserAccountManager } from '../utils/userAccountManager.js';
import { OAuth2Client, Compute } from 'google-auth-library'; import { OAuth2Client, Compute } from 'google-auth-library';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import http from 'http'; import http from 'node:http';
import open from 'open'; import open from 'open';
import crypto from 'crypto'; import crypto from 'node:crypto';
import * as os from 'os'; import * as os from 'node:os';
import { AuthType } from '../core/contentGenerator.js'; import { AuthType } from '../core/contentGenerator.js';
import { Config } from '../config/config.js'; import { Config } from '../config/config.js';
import readline from 'node:readline'; import readline from 'node:readline';

View file

@ -10,10 +10,10 @@ import {
Compute, Compute,
CodeChallengeMethod, CodeChallengeMethod,
} from 'google-auth-library'; } from 'google-auth-library';
import * as http from 'http'; import * as http from 'node:http';
import url from 'url'; import url from 'node:url';
import crypto from 'crypto'; import crypto from 'node:crypto';
import * as net from 'net'; import * as net from 'node:net';
import open from 'open'; import open from 'open';
import path from 'node:path'; import path from 'node:path';
import { promises as fs } from 'node:fs'; import { promises as fs } from 'node:fs';

View file

@ -21,7 +21,7 @@ import {
GenerateContentParameters, GenerateContentParameters,
GenerateContentResponse, GenerateContentResponse,
} from '@google/genai'; } from '@google/genai';
import * as readline from 'readline'; import * as readline from 'node:readline';
import { ContentGenerator } from '../core/contentGenerator.js'; import { ContentGenerator } from '../core/contentGenerator.js';
import { UserTierId } from './types.js'; import { UserTierId } from './types.js';
import { import {

View file

@ -7,7 +7,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest';
import { Mock } from 'vitest'; import { Mock } from 'vitest';
import { Config, ConfigParameters, SandboxConfig } from './config.js'; import { Config, ConfigParameters, SandboxConfig } from './config.js';
import * as path from 'path'; import * as path from 'node:path';
import { setGeminiMdFilename as mockSetGeminiMdFilename } from '../tools/memoryTool.js'; import { setGeminiMdFilename as mockSetGeminiMdFilename } from '../tools/memoryTool.js';
import { import {
DEFAULT_TELEMETRY_TARGET, DEFAULT_TELEMETRY_TARGET,

View file

@ -5,7 +5,7 @@
*/ */
import { describe, it, expect, vi } from 'vitest'; import { describe, it, expect, vi } from 'vitest';
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'node:path'; import * as path from 'node:path';
vi.mock('fs', async (importOriginal) => { vi.mock('fs', async (importOriginal) => {

View file

@ -5,9 +5,9 @@
*/ */
import * as path from 'node:path'; import * as path from 'node:path';
import * as os from 'os'; import * as os from 'node:os';
import * as crypto from 'crypto'; import * as crypto from 'node:crypto';
import * as fs from 'fs'; import * as fs from 'node:fs';
export const GEMINI_DIR = '.gemini'; export const GEMINI_DIR = '.gemini';
export const GOOGLE_ACCOUNTS_FILENAME = 'google_accounts.json'; export const GOOGLE_ACCOUNTS_FILENAME = 'google_accounts.json';

View file

@ -6,9 +6,9 @@
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import { getIdeInstaller, IdeInstaller } from './ide-installer.js'; import { getIdeInstaller, IdeInstaller } from './ide-installer.js';
import * as child_process from 'child_process'; import * as child_process from 'node:child_process';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as os from 'os'; import * as os from 'node:os';
import { DetectedIde } from './detect-ide.js'; import { DetectedIde } from './detect-ide.js';
vi.mock('child_process'); vi.mock('child_process');

View file

@ -4,11 +4,11 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as child_process from 'child_process'; import * as child_process from 'node:child_process';
import * as process from 'process'; import * as process from 'node:process';
import * as path from 'path'; import * as path from 'node:path';
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as os from 'os'; import * as os from 'node:os';
import { DetectedIde } from './detect-ide.js'; import { DetectedIde } from './detect-ide.js';
import { GEMINI_CLI_COMPANION_EXTENSION_NAME } from './constants.js'; import { GEMINI_CLI_COMPANION_EXTENSION_NAME } from './constants.js';

View file

@ -4,10 +4,10 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { exec } from 'child_process'; import { exec } from 'node:child_process';
import { promisify } from 'util'; import { promisify } from 'node:util';
import os from 'os'; import os from 'node:os';
import path from 'path'; import path from 'node:path';
const execAsync = promisify(exec); const execAsync = promisify(exec);

View file

@ -5,9 +5,9 @@
*/ */
import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as os from 'os'; import * as os from 'node:os';
import * as path from 'path'; import * as path from 'node:path';
import { FileDiscoveryService } from './fileDiscoveryService.js'; import { FileDiscoveryService } from './fileDiscoveryService.js';
describe('FileDiscoveryService', () => { describe('FileDiscoveryService', () => {

View file

@ -6,7 +6,7 @@
import { GitIgnoreParser, GitIgnoreFilter } from '../utils/gitIgnoreParser.js'; import { GitIgnoreParser, GitIgnoreFilter } from '../utils/gitIgnoreParser.js';
import { isGitRepository } from '../utils/gitUtils.js'; import { isGitRepository } from '../utils/gitUtils.js';
import * as path from 'path'; import * as path from 'node:path';
const GEMINI_IGNORE_FILE_NAME = '.geminiignore'; const GEMINI_IGNORE_FILE_NAME = '.geminiignore';

View file

@ -5,7 +5,7 @@
*/ */
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import fs from 'fs/promises'; import fs from 'node:fs/promises';
import { StandardFileSystemService } from './fileSystemService.js'; import { StandardFileSystemService } from './fileSystemService.js';
vi.mock('fs/promises'); vi.mock('fs/promises');

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import fs from 'fs/promises'; import fs from 'node:fs/promises';
/** /**
* Interface for file system operations that may be delegated to different implementations * Interface for file system operations that may be delegated to different implementations

View file

@ -7,9 +7,9 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { GitService } from './gitService.js'; import { GitService } from './gitService.js';
import { Storage } from '../config/storage.js'; import { Storage } from '../config/storage.js';
import * as path from 'path'; import * as path from 'node:path';
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as os from 'os'; import * as os from 'node:os';
import type { ChildProcess } from 'node:child_process'; import type { ChildProcess } from 'node:child_process';
import { getProjectHash, GEMINI_DIR } from '../utils/paths.js'; import { getProjectHash, GEMINI_DIR } from '../utils/paths.js';

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as fs from 'fs/promises'; import * as fs from 'node:fs/promises';
import * as path from 'path'; import * as path from 'node:path';
import { isNodeError } from '../utils/errors.js'; import { isNodeError } from '../utils/errors.js';
import { exec } from 'node:child_process'; import { exec } from 'node:child_process';
import { simpleGit, SimpleGit, CheckRepoActions } from 'simple-git'; import { simpleGit, SimpleGit, CheckRepoActions } from 'simple-git';

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { createHash } from 'crypto'; import { createHash } from 'node:crypto';
import { GeminiEventType, ServerGeminiStreamEvent } from '../core/turn.js'; import { GeminiEventType, ServerGeminiStreamEvent } from '../core/turn.js';
import { logLoopDetected } from '../telemetry/loggers.js'; import { logLoopDetected } from '../telemetry/loggers.js';
import { LoopDetectedEvent, LoopType } from '../telemetry/types.js'; import { LoopDetectedEvent, LoopType } from '../telemetry/types.js';

View file

@ -5,9 +5,9 @@
*/ */
import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest'; import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest';
import EventEmitter from 'events'; import EventEmitter from 'node:events';
import { Readable } from 'stream'; import { Readable } from 'node:stream';
import { type ChildProcess } from 'child_process'; import { type ChildProcess } from 'node:child_process';
import { import {
ShellExecutionService, ShellExecutionService,
ShellOutputEvent, ShellOutputEvent,

View file

@ -5,9 +5,9 @@
*/ */
import { getPty, PtyImplementation } from '../utils/getPty.js'; import { getPty, PtyImplementation } from '../utils/getPty.js';
import { spawn as cpSpawn } from 'child_process'; import { spawn as cpSpawn } from 'node:child_process';
import { TextDecoder } from 'util'; import { TextDecoder } from 'node:util';
import os from 'os'; import os from 'node:os';
import { getCachedEncodingForBuffer } from '../utils/systemEncoding.js'; import { getCachedEncodingForBuffer } from '../utils/systemEncoding.js';
import { isBinary } from '../utils/textUtils.js'; import { isBinary } from '../utils/textUtils.js';
import pkg from '@xterm/headless'; import pkg from '@xterm/headless';

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { EventEmitter } from 'events'; import { EventEmitter } from 'node:events';
import { import {
EVENT_API_ERROR, EVENT_API_ERROR,
EVENT_API_RESPONSE, EVENT_API_RESPONSE,

View file

@ -34,9 +34,9 @@ import { describe, it, expect, beforeEach, afterEach, vi, Mock } from 'vitest';
import { applyReplacement, EditTool, EditToolParams } from './edit.js'; import { applyReplacement, EditTool, EditToolParams } from './edit.js';
import { FileDiff, ToolConfirmationOutcome } from './tools.js'; import { FileDiff, ToolConfirmationOutcome } from './tools.js';
import { ToolErrorType } from './tool-error.js'; import { ToolErrorType } from './tool-error.js';
import path from 'path'; import path from 'node:path';
import fs from 'fs'; import fs from 'node:fs';
import os from 'os'; import os from 'node:os';
import { ApprovalMode, Config } from '../config/config.js'; import { ApprovalMode, Config } from '../config/config.js';
import { Content, Part, SchemaUnion } from '@google/genai'; import { Content, Part, SchemaUnion } from '@google/genai';
import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js'; import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js';

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as path from 'path'; import * as path from 'node:path';
import * as Diff from 'diff'; import * as Diff from 'diff';
import { import {
BaseDeclarativeTool, BaseDeclarativeTool,

View file

@ -6,9 +6,9 @@
import { GlobTool, GlobToolParams, GlobPath, sortFileEntries } from './glob.js'; import { GlobTool, GlobToolParams, GlobPath, sortFileEntries } from './glob.js';
import { partListUnionToString } from '../core/geminiRequest.js'; import { partListUnionToString } from '../core/geminiRequest.js';
import path from 'path'; import path from 'node:path';
import fs from 'fs/promises'; import fs from 'node:fs/promises';
import os from 'os'; import os from 'node:os';
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; import { FileDiscoveryService } from '../services/fileDiscoveryService.js';
import { Config } from '../config/config.js'; import { Config } from '../config/config.js';

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import fs from 'fs'; import fs from 'node:fs';
import path from 'path'; import path from 'node:path';
import { glob, escape } from 'glob'; import { glob, escape } from 'glob';
import { import {
BaseDeclarativeTool, BaseDeclarativeTool,

Some files were not shown because too many files have changed in this diff Show more