refactor: remove imported multiple times (#1846)

This commit is contained in:
Noritaka Kobayashi 2025-06-29 18:09:15 +09:00 committed by GitHub
parent e188daab91
commit b980a47879
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 20 additions and 14 deletions

View File

@ -4,8 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { spawnSync } from 'child_process';
import { spawn } from 'child_process';
import { spawnSync, spawn } from 'child_process';
import { mkdirSync, rmSync, createWriteStream } from 'fs';
import { join, dirname, basename } from 'path';
import { fileURLToPath } from 'url';

View File

@ -21,10 +21,13 @@ import { ShellTool } from '../tools/shell.js';
import { WriteFileTool } from '../tools/write-file.js';
import { WebFetchTool } from '../tools/web-fetch.js';
import { ReadManyFilesTool } from '../tools/read-many-files.js';
import { MemoryTool, setGeminiMdFilename } from '../tools/memoryTool.js';
import {
MemoryTool,
setGeminiMdFilename,
GEMINI_CONFIG_DIR as GEMINI_DIR,
} from '../tools/memoryTool.js';
import { WebSearchTool } from '../tools/web-search.js';
import { GeminiClient } from '../core/client.js';
import { GEMINI_CONFIG_DIR as GEMINI_DIR } from '../tools/memoryTool.js';
import { FileDiscoveryService } from '../services/fileDiscoveryService.js';
import { GitService } from '../services/gitService.js';
import { getProjectTempDir } from '../utils/paths.js';

View File

@ -32,13 +32,13 @@ import { retryWithBackoff } from '../utils/retry.js';
import { getErrorMessage } from '../utils/errors.js';
import { tokenLimit } from './tokenLimits.js';
import {
AuthType,
ContentGenerator,
ContentGeneratorConfig,
createContentGenerator,
} from './contentGenerator.js';
import { ProxyAgent, setGlobalDispatcher } from 'undici';
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
import { AuthType } from './contentGenerator.js';
function isThinkingSupported(model: string) {
if (model.startsWith('gemini-2.5')) return true;

View File

@ -10,6 +10,7 @@ import {
CoreToolScheduler,
ToolCall,
ValidatingToolCall,
convertToFunctionResponse,
} from './coreToolScheduler.js';
import {
BaseTool,
@ -19,7 +20,6 @@ import {
Config,
} from '../index.js';
import { Part, PartListUnion } from '@google/genai';
import { convertToFunctionResponse } from './coreToolScheduler.js';
class MockTool extends BaseTool<Record<string, unknown>, ToolResult> {
shouldConfirm = false;

View File

@ -18,9 +18,12 @@ import {
} from '../tools/tools.js';
import { getResponseText } from '../utils/generateContentResponseUtilities.js';
import { reportError } from '../utils/errorReporting.js';
import { getErrorMessage } from '../utils/errors.js';
import {
getErrorMessage,
UnauthorizedError,
toFriendlyError,
} from '../utils/errors.js';
import { GeminiChat } from './geminiChat.js';
import { UnauthorizedError, toFriendlyError } from '../utils/errors.js';
// Define a structure for tools passed to the server
export interface ServerTool {

View File

@ -4,12 +4,11 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { EditorType } from '../utils/editor.js';
import { EditorType, openDiff } from '../utils/editor.js';
import os from 'os';
import path from 'path';
import fs from 'fs';
import * as Diff from 'diff';
import { openDiff } from '../utils/editor.js';
import { DEFAULT_DIFF_OPTIONS } from './diffOptions.js';
import { isNodeError } from '../utils/errors.js';
import { Tool } from './tools.js';

View File

@ -8,9 +8,12 @@ import path from 'path';
import { SchemaValidator } from '../utils/schemaValidator.js';
import { makeRelative, shortenPath } from '../utils/paths.js';
import { BaseTool, ToolResult } from './tools.js';
import { isWithinRoot, processSingleFileContent } from '../utils/fileUtils.js';
import {
isWithinRoot,
processSingleFileContent,
getSpecificMimeType,
} from '../utils/fileUtils.js';
import { Config } from '../config/config.js';
import { getSpecificMimeType } from '../utils/fileUtils.js';
import {
recordFileOperationMetric,
FileOperation,

View File

@ -4,9 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { vi } from 'vitest';
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import type { Mock } from 'vitest';
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { mockControl } from '../__mocks__/fs/promises.js';
import { ReadManyFilesTool } from './read-many-files.js';
import { FileDiscoveryService } from '../services/fileDiscoveryService.js';