mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-28 06:50:35 -07:00
merge duplicate imports packages/cli/src subtask3 (#22056)
This commit is contained in:
@@ -9,14 +9,13 @@ import type React from 'react';
|
||||
import { act } from 'react';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
import type { Mock } from 'vitest';
|
||||
import { vi, afterAll, beforeAll } from 'vitest';
|
||||
import type { Key } from './KeypressContext.js';
|
||||
import { vi, afterAll, beforeAll, type Mock } from 'vitest';
|
||||
import {
|
||||
KeypressProvider,
|
||||
useKeypressContext,
|
||||
ESC_TIMEOUT,
|
||||
FAST_RETURN_TIMEOUT,
|
||||
type Key,
|
||||
} from './KeypressContext.js';
|
||||
import { terminalCapabilityManager } from '../utils/terminalCapabilityManager.js';
|
||||
import { useStdin } from 'ink';
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
*/
|
||||
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import type React from 'react';
|
||||
import { act } from 'react';
|
||||
import { MouseProvider, useMouseContext, useMouse } from './MouseContext.js';
|
||||
import { vi, type Mock } from 'vitest';
|
||||
import type React from 'react';
|
||||
import { useStdin } from 'ink';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { appEvents, AppEvent } from '../../utils/events.js';
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { type MutableRefObject, Component, type ReactNode } from 'react';
|
||||
import { type MutableRefObject, Component, type ReactNode, act } from 'react';
|
||||
import { render } from '../../test-utils/render.js';
|
||||
|
||||
import { act } from 'react';
|
||||
import type { SessionMetrics } from './SessionContext.js';
|
||||
import { SessionStatsProvider, useSessionStats } from './SessionContext.js';
|
||||
import {
|
||||
SessionStatsProvider,
|
||||
useSessionStats,
|
||||
type SessionMetrics,
|
||||
} from './SessionContext.js';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { uiTelemetryService } from '@google/gemini-cli-core';
|
||||
|
||||
|
||||
@@ -5,17 +5,16 @@
|
||||
*/
|
||||
|
||||
import type React from 'react';
|
||||
import { Component, type ReactNode } from 'react';
|
||||
import { Component, type ReactNode, act } from 'react';
|
||||
import { renderHook, render } from '../../test-utils/render.js';
|
||||
import { act } from 'react';
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { SettingsContext, useSettingsStore } from './SettingsContext.js';
|
||||
import {
|
||||
type LoadedSettings,
|
||||
SettingScope,
|
||||
createTestMergedSettings,
|
||||
type LoadedSettings,
|
||||
type LoadedSettingsSnapshot,
|
||||
type SettingsFile,
|
||||
createTestMergedSettings,
|
||||
} from '../../config/settings.js';
|
||||
|
||||
const createMockSettingsFile = (path: string): SettingsFile => ({
|
||||
|
||||
@@ -4,10 +4,16 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { Mock } from 'vitest';
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import {
|
||||
describe,
|
||||
it,
|
||||
expect,
|
||||
vi,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
type Mock,
|
||||
} from 'vitest';
|
||||
import { handleAtCommand } from './atCommandProcessor.js';
|
||||
import type { Config, DiscoveredMCPResource } from '@google/gemini-cli-core';
|
||||
import {
|
||||
FileDiscoveryService,
|
||||
GlobTool,
|
||||
@@ -18,6 +24,8 @@ import {
|
||||
GEMINI_IGNORE_FILE_NAME,
|
||||
// DEFAULT_FILE_EXCLUDES,
|
||||
CoreToolCallStatus,
|
||||
type Config,
|
||||
type DiscoveredMCPResource,
|
||||
} from '@google/gemini-cli-core';
|
||||
import * as core from '@google/gemini-cli-core';
|
||||
import * as os from 'node:os';
|
||||
|
||||
@@ -9,19 +9,18 @@ import { act } from 'react';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
import { useSlashCommandProcessor } from './slashCommandProcessor.js';
|
||||
import type { SlashCommand } from '../commands/types.js';
|
||||
import { CommandKind } from '../commands/types.js';
|
||||
import { CommandKind, type SlashCommand } from '../commands/types.js';
|
||||
import type { LoadedSettings } from '../../config/settings.js';
|
||||
import { MessageType } from '../types.js';
|
||||
import { BuiltinCommandLoader } from '../../services/BuiltinCommandLoader.js';
|
||||
import { FileCommandLoader } from '../../services/FileCommandLoader.js';
|
||||
import { McpPromptLoader } from '../../services/McpPromptLoader.js';
|
||||
import {
|
||||
type GeminiClient,
|
||||
SlashCommandStatus,
|
||||
MCPDiscoveryState,
|
||||
makeFakeConfig,
|
||||
coreEvents,
|
||||
type GeminiClient,
|
||||
} from '@google/gemini-cli-core';
|
||||
|
||||
const {
|
||||
|
||||
@@ -17,10 +17,12 @@ import { act } from 'react';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { useApprovalModeIndicator } from './useApprovalModeIndicator.js';
|
||||
|
||||
import { Config, ApprovalMode } from '@google/gemini-cli-core';
|
||||
import type { Config as ActualConfigType } from '@google/gemini-cli-core';
|
||||
import type { Key } from './useKeypress.js';
|
||||
import { useKeypress } from './useKeypress.js';
|
||||
import {
|
||||
Config,
|
||||
ApprovalMode,
|
||||
type Config as ActualConfigType,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { useKeypress, type Key } from './useKeypress.js';
|
||||
import { MessageType } from '../types.js';
|
||||
|
||||
vi.mock('./useKeypress.js');
|
||||
|
||||
@@ -13,8 +13,7 @@ import {
|
||||
import { useKeypress } from './useKeypress.js';
|
||||
import { Command } from '../key/keyMatchers.js';
|
||||
import { useKeyMatchers } from './useKeyMatchers.js';
|
||||
import type { HistoryItemWithoutId } from '../types.js';
|
||||
import { MessageType } from '../types.js';
|
||||
import { MessageType, type HistoryItemWithoutId } from '../types.js';
|
||||
|
||||
export interface UseApprovalModeIndicatorArgs {
|
||||
config: Config;
|
||||
|
||||
@@ -10,14 +10,18 @@ import * as path from 'node:path';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
import { useAtCompletion } from './useAtCompletion.js';
|
||||
import type { Config, FileSearch } from '@google/gemini-cli-core';
|
||||
import {
|
||||
FileSearchFactory,
|
||||
FileDiscoveryService,
|
||||
escapePath,
|
||||
type Config,
|
||||
type FileSearch,
|
||||
} from '@google/gemini-cli-core';
|
||||
import type { FileSystemStructure } from '@google/gemini-cli-test-utils';
|
||||
import { createTmpDir, cleanupTmpDir } from '@google/gemini-cli-test-utils';
|
||||
import {
|
||||
createTmpDir,
|
||||
cleanupTmpDir,
|
||||
type FileSystemStructure,
|
||||
} from '@google/gemini-cli-test-utils';
|
||||
import type { Suggestion } from '../components/SuggestionsDisplay.js';
|
||||
|
||||
// Test harness to capture the state from the hook's callbacks.
|
||||
|
||||
@@ -7,14 +7,17 @@
|
||||
import { useEffect, useReducer, useRef } from 'react';
|
||||
import { setTimeout as setTimeoutPromise } from 'node:timers/promises';
|
||||
import * as path from 'node:path';
|
||||
import type { Config, FileSearch } from '@google/gemini-cli-core';
|
||||
import {
|
||||
FileSearchFactory,
|
||||
escapePath,
|
||||
FileDiscoveryService,
|
||||
type Config,
|
||||
type FileSearch,
|
||||
} from '@google/gemini-cli-core';
|
||||
import type { Suggestion } from '../components/SuggestionsDisplay.js';
|
||||
import { MAX_SUGGESTIONS_TO_SHOW } from '../components/SuggestionsDisplay.js';
|
||||
import {
|
||||
MAX_SUGGESTIONS_TO_SHOW,
|
||||
type Suggestion,
|
||||
} from '../components/SuggestionsDisplay.js';
|
||||
import { CommandKind } from '../commands/types.js';
|
||||
import { AsyncFzf } from 'fzf';
|
||||
|
||||
|
||||
@@ -24,10 +24,14 @@ import type { CommandContext } from '../commands/types.js';
|
||||
import type { Config } from '@google/gemini-cli-core';
|
||||
import { useTextBuffer } from '../components/shared/text-buffer.js';
|
||||
import type { Suggestion } from '../components/SuggestionsDisplay.js';
|
||||
import type { UseAtCompletionProps } from './useAtCompletion.js';
|
||||
import { useAtCompletion } from './useAtCompletion.js';
|
||||
import type { UseSlashCompletionProps } from './useSlashCompletion.js';
|
||||
import { useSlashCompletion } from './useSlashCompletion.js';
|
||||
import {
|
||||
useAtCompletion,
|
||||
type UseAtCompletionProps,
|
||||
} from './useAtCompletion.js';
|
||||
import {
|
||||
useSlashCompletion,
|
||||
type UseSlashCompletionProps,
|
||||
} from './useSlashCompletion.js';
|
||||
import { useShellCompletion } from './useShellCompletion.js';
|
||||
|
||||
vi.mock('./useAtCompletion', () => ({
|
||||
|
||||
@@ -14,10 +14,10 @@ import { toCodePoints } from '../utils/textUtils.js';
|
||||
import { useAtCompletion } from './useAtCompletion.js';
|
||||
import { useSlashCompletion } from './useSlashCompletion.js';
|
||||
import { useShellCompletion } from './useShellCompletion.js';
|
||||
import type { PromptCompletion } from './usePromptCompletion.js';
|
||||
import {
|
||||
usePromptCompletion,
|
||||
PROMPT_COMPLETION_MIN_LENGTH,
|
||||
type PromptCompletion,
|
||||
} from './usePromptCompletion.js';
|
||||
import type { Config } from '@google/gemini-cli-core';
|
||||
import { useCompletion } from './useCompletion.js';
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
|
||||
import { useState, useCallback } from 'react';
|
||||
|
||||
import type { Suggestion } from '../components/SuggestionsDisplay.js';
|
||||
import { MAX_SUGGESTIONS_TO_SHOW } from '../components/SuggestionsDisplay.js';
|
||||
import {
|
||||
MAX_SUGGESTIONS_TO_SHOW,
|
||||
type Suggestion,
|
||||
} from '../components/SuggestionsDisplay.js';
|
||||
|
||||
export interface UseCompletionReturn {
|
||||
suggestions: Suggestion[];
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
|
||||
import { useMemo } from 'react';
|
||||
import { useUIState } from '../contexts/UIStateContext.js';
|
||||
import { getConfirmingToolState } from '../utils/confirmingTool.js';
|
||||
import type { ConfirmingToolState } from '../utils/confirmingTool.js';
|
||||
import {
|
||||
getConfirmingToolState,
|
||||
type ConfirmingToolState,
|
||||
} from '../utils/confirmingTool.js';
|
||||
|
||||
export type { ConfirmingToolState } from '../utils/confirmingTool.js';
|
||||
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { debugLogger, type GeminiCLIExtension } from '@google/gemini-cli-core';
|
||||
import {
|
||||
debugLogger,
|
||||
checkExhaustive,
|
||||
type GeminiCLIExtension,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { getErrorMessage } from '../../utils/errors.js';
|
||||
import {
|
||||
ExtensionUpdateState,
|
||||
@@ -19,7 +23,6 @@ import {
|
||||
updateExtension,
|
||||
} from '../../config/extensions/update.js';
|
||||
import { type ExtensionUpdateInfo } from '../../config/extension.js';
|
||||
import { checkExhaustive } from '@google/gemini-cli-core';
|
||||
import type { ExtensionManager } from '../../config/extension-manager.js';
|
||||
|
||||
type ConfirmationRequestWrapper = {
|
||||
|
||||
@@ -8,8 +8,7 @@ import { renderHook } from '../../test-utils/render.js';
|
||||
import { vi, type Mock } from 'vitest';
|
||||
import { useFlickerDetector } from './useFlickerDetector.js';
|
||||
import { useConfig } from '../contexts/ConfigContext.js';
|
||||
import { recordFlickerFrame } from '@google/gemini-cli-core';
|
||||
import { type Config } from '@google/gemini-cli-core';
|
||||
import { recordFlickerFrame, type Config } from '@google/gemini-cli-core';
|
||||
import { type DOMElement, measureElement } from 'ink';
|
||||
import { useUIState } from '../contexts/UIStateContext.js';
|
||||
import { appEvents, AppEvent } from '../../utils/events.js';
|
||||
|
||||
@@ -20,8 +20,10 @@ import { waitFor } from '../../test-utils/async.js';
|
||||
import { useFolderTrust } from './useFolderTrust.js';
|
||||
import type { LoadedSettings } from '../../config/settings.js';
|
||||
import { FolderTrustChoice } from '../components/FolderTrustDialog.js';
|
||||
import type { LoadedTrustedFolders } from '../../config/trustedFolders.js';
|
||||
import { TrustLevel } from '../../config/trustedFolders.js';
|
||||
import {
|
||||
TrustLevel,
|
||||
type LoadedTrustedFolders,
|
||||
} from '../../config/trustedFolders.js';
|
||||
import * as trustedFolders from '../../config/trustedFolders.js';
|
||||
import { coreEvents, ExitCodes, isHeadlessMode } from '@google/gemini-cli-core';
|
||||
import { MessageType } from '../types.js';
|
||||
|
||||
@@ -5,22 +5,29 @@
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import type { Mock, MockInstance } from 'vitest';
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import {
|
||||
describe,
|
||||
it,
|
||||
expect,
|
||||
vi,
|
||||
beforeEach,
|
||||
type Mock,
|
||||
type MockInstance,
|
||||
} from 'vitest';
|
||||
import { act } from 'react';
|
||||
import { renderHookWithProviders } from '../../test-utils/render.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
import { useGeminiStream } from './useGeminiStream.js';
|
||||
import { useKeypress } from './useKeypress.js';
|
||||
import * as atCommandProcessor from './atCommandProcessor.js';
|
||||
import type {
|
||||
TrackedToolCall,
|
||||
TrackedCompletedToolCall,
|
||||
TrackedExecutingToolCall,
|
||||
TrackedCancelledToolCall,
|
||||
TrackedWaitingToolCall,
|
||||
import {
|
||||
useToolScheduler,
|
||||
type TrackedToolCall,
|
||||
type TrackedCompletedToolCall,
|
||||
type TrackedExecutingToolCall,
|
||||
type TrackedCancelledToolCall,
|
||||
type TrackedWaitingToolCall,
|
||||
} from './useToolScheduler.js';
|
||||
import { useToolScheduler } from './useToolScheduler.js';
|
||||
import type {
|
||||
Config,
|
||||
EditorType,
|
||||
|
||||
@@ -4,8 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { MockedFunction } from 'vitest';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import {
|
||||
afterEach,
|
||||
beforeEach,
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
vi,
|
||||
type MockedFunction,
|
||||
} from 'vitest';
|
||||
import { act } from 'react';
|
||||
import { render } from '../../test-utils/render.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
|
||||
@@ -4,8 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import type { Mock } from 'vitest';
|
||||
import {
|
||||
vi,
|
||||
describe,
|
||||
it,
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
type Mock,
|
||||
} from 'vitest';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
import { useIncludeDirsTrust } from './useIncludeDirsTrust.js';
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
import type React from 'react';
|
||||
import { createContext, useContext } from 'react';
|
||||
import type { KeyMatchers } from '../key/keyMatchers.js';
|
||||
import { defaultKeyMatchers } from '../key/keyMatchers.js';
|
||||
import { defaultKeyMatchers, type KeyMatchers } from '../key/keyMatchers.js';
|
||||
|
||||
export const KeyMatchersContext =
|
||||
createContext<KeyMatchers>(defaultKeyMatchers);
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
*/
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import type { Storage } from '@google/gemini-cli-core';
|
||||
import { sessionId, Logger } from '@google/gemini-cli-core';
|
||||
import { sessionId, Logger, type Storage } from '@google/gemini-cli-core';
|
||||
|
||||
/**
|
||||
* Hook to manage the logger instance.
|
||||
|
||||
@@ -5,8 +5,11 @@
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import type { MouseHandler, MouseEvent } from '../contexts/MouseContext.js';
|
||||
import { useMouseContext } from '../contexts/MouseContext.js';
|
||||
import {
|
||||
useMouseContext,
|
||||
type MouseHandler,
|
||||
type MouseEvent,
|
||||
} from '../contexts/MouseContext.js';
|
||||
|
||||
export type { MouseEvent };
|
||||
|
||||
|
||||
@@ -16,9 +16,11 @@ import {
|
||||
import { act } from 'react';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { usePermissionsModifyTrust } from './usePermissionsModifyTrust.js';
|
||||
import { TrustLevel } from '../../config/trustedFolders.js';
|
||||
import {
|
||||
TrustLevel,
|
||||
type LoadedTrustedFolders,
|
||||
} from '../../config/trustedFolders.js';
|
||||
import type { LoadedSettings } from '../../config/settings.js';
|
||||
import type { LoadedTrustedFolders } from '../../config/trustedFolders.js';
|
||||
import { coreEvents } from '@google/gemini-cli-core';
|
||||
|
||||
// Hoist mocks
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { act } from 'react';
|
||||
import { render } from '../../test-utils/render.js';
|
||||
import type { Config, CodeAssistServer } from '@google/gemini-cli-core';
|
||||
import { UserTierId, getCodeAssistServer } from '@google/gemini-cli-core';
|
||||
import {
|
||||
UserTierId,
|
||||
getCodeAssistServer,
|
||||
type Config,
|
||||
type CodeAssistServer,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { usePrivacySettings } from './usePrivacySettings.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
|
||||
|
||||
@@ -5,8 +5,12 @@
|
||||
*/
|
||||
|
||||
import { useState, useCallback, useRef, useEffect, useMemo } from 'react';
|
||||
import type { Config } from '@google/gemini-cli-core';
|
||||
import { debugLogger, getResponseText, LlmRole } from '@google/gemini-cli-core';
|
||||
import {
|
||||
debugLogger,
|
||||
getResponseText,
|
||||
LlmRole,
|
||||
type Config,
|
||||
} from '@google/gemini-cli-core';
|
||||
import type { Content } from '@google/genai';
|
||||
import type { TextBuffer } from '../components/shared/text-buffer.js';
|
||||
import { isSlashCommand } from '../utils/commandUtils.js';
|
||||
|
||||
@@ -8,12 +8,12 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { act } from 'react';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { useRewind } from './useRewind.js';
|
||||
import * as rewindFileOps from '../utils/rewindFileOps.js';
|
||||
import type { FileChangeStats } from '../utils/rewindFileOps.js';
|
||||
import type {
|
||||
ConversationRecord,
|
||||
MessageRecord,
|
||||
} from '@google/gemini-cli-core';
|
||||
import type { FileChangeStats } from '../utils/rewindFileOps.js';
|
||||
import * as rewindFileOps from '../utils/rewindFileOps.js';
|
||||
|
||||
// Mock the dependency
|
||||
vi.mock('../utils/rewindFileOps.js', () => ({
|
||||
|
||||
@@ -8,18 +8,18 @@ import { useState, useCallback } from 'react';
|
||||
import type { HistoryItemWithoutId } from '../types.js';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import type {
|
||||
Config,
|
||||
ConversationRecord,
|
||||
ResumedSessionData,
|
||||
} from '@google/gemini-cli-core';
|
||||
import {
|
||||
coreEvents,
|
||||
convertSessionToClientHistory,
|
||||
uiTelemetryService,
|
||||
type Config,
|
||||
type ConversationRecord,
|
||||
type ResumedSessionData,
|
||||
} from '@google/gemini-cli-core';
|
||||
import type { SessionInfo } from '../../utils/sessionUtils.js';
|
||||
import { convertSessionToHistoryFormats } from '../../utils/sessionUtils.js';
|
||||
import {
|
||||
convertSessionToHistoryFormats,
|
||||
type SessionInfo,
|
||||
} from '../../utils/sessionUtils.js';
|
||||
import type { Part } from '@google/genai';
|
||||
|
||||
export { convertSessionToHistoryFormats };
|
||||
|
||||
@@ -11,8 +11,11 @@ import {
|
||||
resolvePathCompletions,
|
||||
scanPathExecutables,
|
||||
} from './useShellCompletion.js';
|
||||
import type { FileSystemStructure } from '@google/gemini-cli-test-utils';
|
||||
import { createTmpDir, cleanupTmpDir } from '@google/gemini-cli-test-utils';
|
||||
import {
|
||||
createTmpDir,
|
||||
cleanupTmpDir,
|
||||
type FileSystemStructure,
|
||||
} from '@google/gemini-cli-test-utils';
|
||||
|
||||
describe('useShellCompletion utilities', () => {
|
||||
describe('getTokenAtCursor', () => {
|
||||
|
||||
@@ -9,8 +9,11 @@ import { act, useState } from 'react';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
import { useSlashCompletion } from './useSlashCompletion.js';
|
||||
import type { CommandContext, SlashCommand } from '../commands/types.js';
|
||||
import { CommandKind } from '../commands/types.js';
|
||||
import {
|
||||
CommandKind,
|
||||
type CommandContext,
|
||||
type SlashCommand,
|
||||
} from '../commands/types.js';
|
||||
import type { Suggestion } from '../components/SuggestionsDisplay.js';
|
||||
|
||||
// Test utility type and helper function for creating test SlashCommands
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { act } from 'react';
|
||||
import { useVim } from './vim.js';
|
||||
import type { VimMode } from './vim.js';
|
||||
import { useVim, type VimMode } from './vim.js';
|
||||
import type { TextBuffer } from '../components/shared/text-buffer.js';
|
||||
import type { Key } from './useKeypress.js';
|
||||
|
||||
|
||||
@@ -17,15 +17,14 @@ import type React from 'react';
|
||||
import { act } from 'react';
|
||||
import { renderHook } from '../../test-utils/render.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
import { useVim } from './vim.js';
|
||||
import type { VimMode } from './vim.js';
|
||||
import { useVim, type VimMode } from './vim.js';
|
||||
import type { Key } from './useKeypress.js';
|
||||
import type {
|
||||
TextBuffer,
|
||||
TextBufferState,
|
||||
TextBufferAction,
|
||||
import {
|
||||
textBufferReducer,
|
||||
type TextBuffer,
|
||||
type TextBufferState,
|
||||
type TextBufferAction,
|
||||
} from '../components/shared/text-buffer.js';
|
||||
import { textBufferReducer } from '../components/shared/text-buffer.js';
|
||||
|
||||
// Mock the VimModeContext
|
||||
const mockVimContext = {
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { ColorsTheme } from '../theme.js';
|
||||
import { Theme } from '../theme.js';
|
||||
import { Theme, type ColorsTheme } from '../theme.js';
|
||||
import type { SemanticColors } from '../semantic-tokens.js';
|
||||
|
||||
const noColorColorsTheme: ColorsTheme = {
|
||||
|
||||
@@ -11,11 +11,10 @@ if (process.env['NO_COLOR'] !== undefined) {
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
||||
import { themeManager, DEFAULT_THEME } from './theme-manager.js';
|
||||
import type { CustomTheme } from '@google/gemini-cli-core';
|
||||
import { debugLogger, type CustomTheme } from '@google/gemini-cli-core';
|
||||
import * as fs from 'node:fs';
|
||||
import * as os from 'node:os';
|
||||
import type * as osActual from 'node:os';
|
||||
import { debugLogger } from '@google/gemini-cli-core';
|
||||
|
||||
vi.mock('node:fs');
|
||||
vi.mock('node:os', async (importOriginal) => {
|
||||
|
||||
@@ -20,8 +20,7 @@ import { SolarizedLight } from './builtin/light/solarized-light.js';
|
||||
import { XCode } from './builtin/light/xcode-light.js';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import type { Theme, ThemeType, ColorsTheme } from './theme.js';
|
||||
import type { CustomTheme } from '@google/gemini-cli-core';
|
||||
import type { Theme, ThemeType, ColorsTheme, CustomTheme } from './theme.js';
|
||||
import {
|
||||
createCustomTheme,
|
||||
validateCustomTheme,
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { Mock } from 'vitest';
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import clipboardy from 'clipboardy';
|
||||
import {
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
/// <reference types="vitest/globals" />
|
||||
|
||||
import type { MockInstance } from 'vitest';
|
||||
import { vi } from 'vitest';
|
||||
import { vi, type MockInstance } from 'vitest';
|
||||
import { TextOutput } from './textOutput.js';
|
||||
|
||||
describe('TextOutput', () => {
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { debugLogger } from '@google/gemini-cli-core';
|
||||
import type { Config } from '@google/gemini-cli-core';
|
||||
import { debugLogger, type Config } from '@google/gemini-cli-core';
|
||||
import WebSocket from 'ws';
|
||||
import {
|
||||
initActivityLogger,
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { SettingScope } from '../config/settings.js';
|
||||
import type { LoadedSettings } from '../config/settings.js';
|
||||
import { SettingScope, type LoadedSettings } from '../config/settings.js';
|
||||
import {
|
||||
getScopeItems,
|
||||
getScopeMessageForSetting,
|
||||
|
||||
@@ -4,8 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { LoadableSettingScope, Settings } from '../config/settings.js';
|
||||
import { isLoadableSettingScope, SettingScope } from '../config/settings.js';
|
||||
import {
|
||||
isLoadableSettingScope,
|
||||
SettingScope,
|
||||
type LoadableSettingScope,
|
||||
type Settings,
|
||||
} from '../config/settings.js';
|
||||
import { isInSettingsScope } from './settingsUtils.js';
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,8 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type { Mock } from 'vitest';
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import {
|
||||
describe,
|
||||
it,
|
||||
expect,
|
||||
vi,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
type Mock,
|
||||
} from 'vitest';
|
||||
import { getInstallationInfo, PackageManager } from './installationInfo.js';
|
||||
import { updateEventEmitter } from './updateEventEmitter.js';
|
||||
import type { UpdateObject } from '../ui/utils/updateCheck.js';
|
||||
|
||||
@@ -8,8 +8,7 @@ import type { UpdateObject } from '../ui/utils/updateCheck.js';
|
||||
import type { LoadedSettings } from '../config/settings.js';
|
||||
import { getInstallationInfo, PackageManager } from './installationInfo.js';
|
||||
import { updateEventEmitter } from './updateEventEmitter.js';
|
||||
import type { HistoryItem } from '../ui/types.js';
|
||||
import { MessageType } from '../ui/types.js';
|
||||
import { MessageType, type HistoryItem } from '../ui/types.js';
|
||||
import { spawnWrapper } from './spawnWrapper.js';
|
||||
import type { spawn } from 'node:child_process';
|
||||
import { debugLogger } from '@google/gemini-cli-core';
|
||||
|
||||
@@ -15,8 +15,7 @@ import {
|
||||
} from 'vitest';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { RELAUNCH_EXIT_CODE } from './processUtils.js';
|
||||
import type { ChildProcess } from 'node:child_process';
|
||||
import { spawn } from 'node:child_process';
|
||||
import { spawn, type ChildProcess } from 'node:child_process';
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
writeToStderr: vi.fn(),
|
||||
|
||||
@@ -12,8 +12,11 @@ import {
|
||||
hasUserOrAssistantMessage,
|
||||
SessionError,
|
||||
} from './sessionUtils.js';
|
||||
import type { Config, MessageRecord } from '@google/gemini-cli-core';
|
||||
import { SESSION_FILE_PREFIX } from '@google/gemini-cli-core';
|
||||
import {
|
||||
SESSION_FILE_PREFIX,
|
||||
type Config,
|
||||
type MessageRecord,
|
||||
} from '@google/gemini-cli-core';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import type { Config } from '@google/gemini-cli-core';
|
||||
import { ChatRecordingService } from '@google/gemini-cli-core';
|
||||
import { ChatRecordingService, type Config } from '@google/gemini-cli-core';
|
||||
import { listSessions, deleteSession } from './sessions.js';
|
||||
import { SessionSelector, type SessionInfo } from './sessionUtils.js';
|
||||
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
*/
|
||||
|
||||
import type { Settings } from '../config/settings.js';
|
||||
import type {
|
||||
SettingDefinition,
|
||||
SettingsSchema,
|
||||
SettingsType,
|
||||
SettingsValue,
|
||||
import {
|
||||
getSettingsSchema,
|
||||
type SettingDefinition,
|
||||
type SettingsSchema,
|
||||
type SettingsType,
|
||||
type SettingsValue,
|
||||
} from '../config/settingsSchema.js';
|
||||
import { getSettingsSchema } from '../config/settingsSchema.js';
|
||||
import type { Config } from '@google/gemini-cli-core';
|
||||
import { ExperimentFlags } from '@google/gemini-cli-core';
|
||||
import { ExperimentFlags, type Config } from '@google/gemini-cli-core';
|
||||
|
||||
// The schema is now nested, but many parts of the UI and logic work better
|
||||
// with a flattened structure and dot-notation keys. This section flattens the
|
||||
|
||||
Reference in New Issue
Block a user