mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
merge duplicate imports packages/cli/src subtask1 (#22040)
This commit is contained in:
@@ -57,15 +57,17 @@ function hasMeta(obj: unknown): obj is { _meta?: Record<string, unknown> } {
|
|||||||
return typeof obj === 'object' && obj !== null && '_meta' in obj;
|
return typeof obj === 'object' && obj !== null && '_meta' in obj;
|
||||||
}
|
}
|
||||||
import type { Content, Part, FunctionCall } from '@google/genai';
|
import type { Content, Part, FunctionCall } from '@google/genai';
|
||||||
import type { LoadedSettings } from '../config/settings.js';
|
import {
|
||||||
import { SettingScope, loadSettings } from '../config/settings.js';
|
SettingScope,
|
||||||
|
loadSettings,
|
||||||
|
type LoadedSettings,
|
||||||
|
} from '../config/settings.js';
|
||||||
import * as fs from 'node:fs/promises';
|
import * as fs from 'node:fs/promises';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { randomUUID } from 'node:crypto';
|
import { randomUUID } from 'node:crypto';
|
||||||
import type { CliArgs } from '../config/config.js';
|
import { loadCliConfig, type CliArgs } from '../config/config.js';
|
||||||
import { loadCliConfig } from '../config/config.js';
|
|
||||||
import { runExitCleanup } from '../utils/cleanup.js';
|
import { runExitCleanup } from '../utils/cleanup.js';
|
||||||
import { SessionSelector } from '../utils/sessionUtils.js';
|
import { SessionSelector } from '../utils/sessionUtils.js';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { listExtensions } from '@google/gemini-cli-core';
|
import { listExtensions, type Config } from '@google/gemini-cli-core';
|
||||||
import { SettingScope } from '../../config/settings.js';
|
import { SettingScope } from '../../config/settings.js';
|
||||||
import {
|
import {
|
||||||
ExtensionManager,
|
ExtensionManager,
|
||||||
@@ -18,7 +18,6 @@ import type {
|
|||||||
CommandContext,
|
CommandContext,
|
||||||
CommandExecutionResponse,
|
CommandExecutionResponse,
|
||||||
} from './types.js';
|
} from './types.js';
|
||||||
import type { Config } from '@google/gemini-cli-core';
|
|
||||||
|
|
||||||
export class ExtensionsCommand implements Command {
|
export class ExtensionsCommand implements Command {
|
||||||
readonly name = 'extensions';
|
readonly name = 'extensions';
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ import {
|
|||||||
import { handleInstall, installCommand } from './install.js';
|
import { handleInstall, installCommand } from './install.js';
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
import * as core from '@google/gemini-cli-core';
|
import * as core from '@google/gemini-cli-core';
|
||||||
import type { inferInstallMetadata } from '../../config/extension-manager.js';
|
import {
|
||||||
import { ExtensionManager } from '../../config/extension-manager.js';
|
ExtensionManager,
|
||||||
|
type inferInstallMetadata,
|
||||||
|
} from '../../config/extension-manager.js';
|
||||||
import type {
|
import type {
|
||||||
promptForConsentNonInteractive,
|
promptForConsentNonInteractive,
|
||||||
requestConsentNonInteractive,
|
requestConsentNonInteractive,
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
import { describe, it, expect, vi } from 'vitest';
|
import { describe, it, expect, vi } from 'vitest';
|
||||||
import { mcpCommand } from './mcp.js';
|
import { mcpCommand } from './mcp.js';
|
||||||
import { type Argv } from 'yargs';
|
import yargs, { type Argv } from 'yargs';
|
||||||
import yargs from 'yargs';
|
|
||||||
|
|
||||||
describe('mcp command', () => {
|
describe('mcp command', () => {
|
||||||
it('should have correct command definition', () => {
|
it('should have correct command definition', () => {
|
||||||
|
|||||||
@@ -5,11 +5,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||||
import { coreEvents } from '@google/gemini-cli-core';
|
import { coreEvents, type Config } from '@google/gemini-cli-core';
|
||||||
import { handleList, listCommand } from './list.js';
|
import { handleList, listCommand } from './list.js';
|
||||||
import { loadSettings, type LoadedSettings } from '../../config/settings.js';
|
import { loadSettings, type LoadedSettings } from '../../config/settings.js';
|
||||||
import { loadCliConfig } from '../../config/config.js';
|
import { loadCliConfig } from '../../config/config.js';
|
||||||
import type { Config } from '@google/gemini-cli-core';
|
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
|
|
||||||
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import * as fs from 'node:fs';
|
|||||||
import * as os from 'node:os';
|
import * as os from 'node:os';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import { ExtensionManager } from './extension-manager.js';
|
import { ExtensionManager } from './extension-manager.js';
|
||||||
import { createTestMergedSettings } from './settings.js';
|
import { createTestMergedSettings, type MergedSettings } from './settings.js';
|
||||||
import { createExtension } from '../test-utils/createExtension.js';
|
import { createExtension } from '../test-utils/createExtension.js';
|
||||||
import { EXTENSIONS_DIRECTORY_NAME } from './extensions/variables.js';
|
import { EXTENSIONS_DIRECTORY_NAME } from './extensions/variables.js';
|
||||||
import {
|
import {
|
||||||
@@ -18,7 +18,6 @@ import {
|
|||||||
isWorkspaceTrusted,
|
isWorkspaceTrusted,
|
||||||
} from './trustedFolders.js';
|
} from './trustedFolders.js';
|
||||||
import { getRealPath } from '@google/gemini-cli-core';
|
import { getRealPath } from '@google/gemini-cli-core';
|
||||||
import type { MergedSettings } from './settings.js';
|
|
||||||
|
|
||||||
const mockHomedir = vi.hoisted(() => vi.fn(() => '/tmp/mock-home'));
|
const mockHomedir = vi.hoisted(() => vi.fn(() => '/tmp/mock-home'));
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,10 @@ import {
|
|||||||
type ExtensionUpdateStatus,
|
type ExtensionUpdateStatus,
|
||||||
} from '../../ui/state/extensions.js';
|
} from '../../ui/state/extensions.js';
|
||||||
import { ExtensionStorage } from './storage.js';
|
import { ExtensionStorage } from './storage.js';
|
||||||
import { copyExtension } from '../extension-manager.js';
|
import { copyExtension, type ExtensionManager } from '../extension-manager.js';
|
||||||
import { checkForExtensionUpdate } from './github.js';
|
import { checkForExtensionUpdate } from './github.js';
|
||||||
import { loadInstallMetadata } from '../extension.js';
|
import { loadInstallMetadata } from '../extension.js';
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import type { ExtensionManager } from '../extension-manager.js';
|
|
||||||
import type { GeminiCLIExtension } from '@google/gemini-cli-core';
|
import type { GeminiCLIExtension } from '@google/gemini-cli-core';
|
||||||
|
|
||||||
// Mock dependencies
|
// Mock dependencies
|
||||||
|
|||||||
@@ -19,9 +19,8 @@ import {
|
|||||||
isWorkspaceTrusted,
|
isWorkspaceTrusted,
|
||||||
resetTrustedFoldersForTesting,
|
resetTrustedFoldersForTesting,
|
||||||
} from './trustedFolders.js';
|
} from './trustedFolders.js';
|
||||||
import { loadEnvironment } from './settings.js';
|
import { loadEnvironment, type Settings } from './settings.js';
|
||||||
import { createMockSettings } from '../test-utils/settings.js';
|
import { createMockSettings } from '../test-utils/settings.js';
|
||||||
import type { Settings } from './settings.js';
|
|
||||||
|
|
||||||
// We explicitly do NOT mock 'fs' or 'proper-lockfile' here to ensure
|
// We explicitly do NOT mock 'fs' or 'proper-lockfile' here to ensure
|
||||||
// we are testing the actual behavior on the real file system.
|
// we are testing the actual behavior on the real file system.
|
||||||
|
|||||||
@@ -4,7 +4,14 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
import {
|
||||||
|
describe,
|
||||||
|
it,
|
||||||
|
expect,
|
||||||
|
vi,
|
||||||
|
beforeEach,
|
||||||
|
type MockInstance,
|
||||||
|
} from 'vitest';
|
||||||
import {
|
import {
|
||||||
runDeferredCommand,
|
runDeferredCommand,
|
||||||
defer,
|
defer,
|
||||||
@@ -14,7 +21,6 @@ import {
|
|||||||
import { ExitCodes } from '@google/gemini-cli-core';
|
import { ExitCodes } from '@google/gemini-cli-core';
|
||||||
import type { ArgumentsCamelCase, CommandModule } from 'yargs';
|
import type { ArgumentsCamelCase, CommandModule } from 'yargs';
|
||||||
import { createMockSettings } from './test-utils/settings.js';
|
import { createMockSettings } from './test-utils/settings.js';
|
||||||
import type { MockInstance } from 'vitest';
|
|
||||||
|
|
||||||
const { mockRunExitCleanup, mockCoreEvents } = vi.hoisted(() => ({
|
const { mockRunExitCleanup, mockCoreEvents } = vi.hoisted(() => ({
|
||||||
mockRunExitCleanup: vi.fn(),
|
mockRunExitCleanup: vi.fn(),
|
||||||
|
|||||||
@@ -21,15 +21,18 @@ import {
|
|||||||
startInteractiveUI,
|
startInteractiveUI,
|
||||||
getNodeMemoryArgs,
|
getNodeMemoryArgs,
|
||||||
} from './gemini.js';
|
} from './gemini.js';
|
||||||
import { loadCliConfig, parseArguments } from './config/config.js';
|
import {
|
||||||
|
loadCliConfig,
|
||||||
|
parseArguments,
|
||||||
|
type CliArgs,
|
||||||
|
} from './config/config.js';
|
||||||
import { loadSandboxConfig } from './config/sandboxConfig.js';
|
import { loadSandboxConfig } from './config/sandboxConfig.js';
|
||||||
import { terminalCapabilityManager } from './ui/utils/terminalCapabilityManager.js';
|
import { terminalCapabilityManager } from './ui/utils/terminalCapabilityManager.js';
|
||||||
import { start_sandbox } from './utils/sandbox.js';
|
import { start_sandbox } from './utils/sandbox.js';
|
||||||
import { validateNonInteractiveAuth } from './validateNonInterActiveAuth.js';
|
import { validateNonInteractiveAuth } from './validateNonInterActiveAuth.js';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import v8 from 'node:v8';
|
import v8 from 'node:v8';
|
||||||
import { type CliArgs } from './config/config.js';
|
import { loadSettings, type LoadedSettings } from './config/settings.js';
|
||||||
import { type LoadedSettings, loadSettings } from './config/settings.js';
|
|
||||||
import {
|
import {
|
||||||
createMockConfig,
|
createMockConfig,
|
||||||
createMockSettings,
|
createMockSettings,
|
||||||
|
|||||||
@@ -16,12 +16,16 @@ import v8 from 'node:v8';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import dns from 'node:dns';
|
import dns from 'node:dns';
|
||||||
import { start_sandbox } from './utils/sandbox.js';
|
import { start_sandbox } from './utils/sandbox.js';
|
||||||
import type { DnsResolutionOrder, LoadedSettings } from './config/settings.js';
|
import {
|
||||||
|
loadSettings,
|
||||||
|
SettingScope,
|
||||||
|
type DnsResolutionOrder,
|
||||||
|
type LoadedSettings,
|
||||||
|
} from './config/settings.js';
|
||||||
import {
|
import {
|
||||||
loadTrustedFolders,
|
loadTrustedFolders,
|
||||||
type TrustedFoldersError,
|
type TrustedFoldersError,
|
||||||
} from './config/trustedFolders.js';
|
} from './config/trustedFolders.js';
|
||||||
import { loadSettings, SettingScope } from './config/settings.js';
|
|
||||||
import { getStartupWarnings } from './utils/startupWarnings.js';
|
import { getStartupWarnings } from './utils/startupWarnings.js';
|
||||||
import { getUserStartupWarnings } from './utils/userStartupWarnings.js';
|
import { getUserStartupWarnings } from './utils/userStartupWarnings.js';
|
||||||
import { ConsolePatcher } from './ui/utils/ConsolePatcher.js';
|
import { ConsolePatcher } from './ui/utils/ConsolePatcher.js';
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||||
import { main } from './gemini.js';
|
import { main } from './gemini.js';
|
||||||
import { debugLogger } from '@google/gemini-cli-core';
|
import { debugLogger, type Config } from '@google/gemini-cli-core';
|
||||||
import { type Config } from '@google/gemini-cli-core';
|
|
||||||
|
|
||||||
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
||||||
const actual =
|
const actual =
|
||||||
|
|||||||
@@ -52,8 +52,7 @@ vi.mock('../ui/commands/permissionsCommand.js', async () => {
|
|||||||
|
|
||||||
import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest';
|
import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest';
|
||||||
import { BuiltinCommandLoader } from './BuiltinCommandLoader.js';
|
import { BuiltinCommandLoader } from './BuiltinCommandLoader.js';
|
||||||
import type { Config } from '@google/gemini-cli-core';
|
import { isNightly, type Config } from '@google/gemini-cli-core';
|
||||||
import { isNightly } from '@google/gemini-cli-core';
|
|
||||||
import { CommandKind } from '../ui/commands/types.js';
|
import { CommandKind } from '../ui/commands/types.js';
|
||||||
|
|
||||||
import { restoreCommand } from '../ui/commands/restoreCommand.js';
|
import { restoreCommand } from '../ui/commands/restoreCommand.js';
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
import * as glob from 'glob';
|
import * as glob from 'glob';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import type { Config } from '@google/gemini-cli-core';
|
import { GEMINI_DIR, Storage, type Config } from '@google/gemini-cli-core';
|
||||||
import { GEMINI_DIR, Storage } from '@google/gemini-cli-core';
|
|
||||||
import mock from 'mock-fs';
|
import mock from 'mock-fs';
|
||||||
import { FileCommandLoader } from './FileCommandLoader.js';
|
import { FileCommandLoader } from './FileCommandLoader.js';
|
||||||
import { assert, vi } from 'vitest';
|
import { assert, vi } from 'vitest';
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ 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';
|
||||||
import type { Config } from '@google/gemini-cli-core';
|
import { Storage, coreEvents, type Config } from '@google/gemini-cli-core';
|
||||||
import { Storage, coreEvents } from '@google/gemini-cli-core';
|
|
||||||
import type { ICommandLoader } from './types.js';
|
import type { ICommandLoader } from './types.js';
|
||||||
import type {
|
import type {
|
||||||
CommandContext,
|
CommandContext,
|
||||||
|
|||||||
@@ -4,14 +4,17 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Config } from '@google/gemini-cli-core';
|
import {
|
||||||
import { getErrorMessage, getMCPServerPrompts } from '@google/gemini-cli-core';
|
getErrorMessage,
|
||||||
import type {
|
getMCPServerPrompts,
|
||||||
CommandContext,
|
type Config,
|
||||||
SlashCommand,
|
} from '@google/gemini-cli-core';
|
||||||
SlashCommandActionReturn,
|
import {
|
||||||
|
CommandKind,
|
||||||
|
type CommandContext,
|
||||||
|
type SlashCommand,
|
||||||
|
type SlashCommandActionReturn,
|
||||||
} from '../ui/commands/types.js';
|
} from '../ui/commands/types.js';
|
||||||
import { CommandKind } from '../ui/commands/types.js';
|
|
||||||
import type { ICommandLoader } from './types.js';
|
import type { ICommandLoader } from './types.js';
|
||||||
import type { PromptArgument } from '@modelcontextprotocol/sdk/types.js';
|
import type { PromptArgument } from '@modelcontextprotocol/sdk/types.js';
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { SlashCommand } from '../ui/commands/types.js';
|
import { CommandKind, type SlashCommand } from '../ui/commands/types.js';
|
||||||
import { CommandKind } from '../ui/commands/types.js';
|
|
||||||
import type { CommandConflict } from './types.js';
|
import type { CommandConflict } from './types.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
||||||
import type { CommandContext } from '../ui/commands/types.js';
|
import type { CommandContext } from '../ui/commands/types.js';
|
||||||
import type { LoadedSettings } from '../config/settings.js';
|
import { mergeSettings, type LoadedSettings } from '../config/settings.js';
|
||||||
import { mergeSettings } from '../config/settings.js';
|
|
||||||
import type { GitService } from '@google/gemini-cli-core';
|
import type { GitService } from '@google/gemini-cli-core';
|
||||||
import type { SessionStatsState } from '../ui/contexts/SessionContext.js';
|
import type { SessionStatsState } from '../ui/contexts/SessionContext.js';
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,11 @@
|
|||||||
|
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
||||||
import type { Config } from '@google/gemini-cli-core';
|
import type { Config } from '@google/gemini-cli-core';
|
||||||
import type { LoadedSettings, Settings } from '../config/settings.js';
|
import {
|
||||||
import { createTestMergedSettings } from '../config/settings.js';
|
createTestMergedSettings,
|
||||||
|
type LoadedSettings,
|
||||||
|
type Settings,
|
||||||
|
} from '../config/settings.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a mocked Config object with default values and allows overrides.
|
* Creates a mocked Config object with default values and allows overrides.
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import {
|
|||||||
} from 'ink';
|
} from 'ink';
|
||||||
import { EventEmitter } from 'node:events';
|
import { EventEmitter } from 'node:events';
|
||||||
import { Box } from 'ink';
|
import { Box } from 'ink';
|
||||||
import type React from 'react';
|
|
||||||
import { Terminal } from '@xterm/headless';
|
import { Terminal } from '@xterm/headless';
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
||||||
import stripAnsi from 'strip-ansi';
|
import stripAnsi from 'strip-ansi';
|
||||||
|
import type React from 'react';
|
||||||
import { act, useState } from 'react';
|
import { act, useState } from 'react';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { CommandContext, SlashCommand } from './types.js';
|
import {
|
||||||
import { CommandKind } from './types.js';
|
CommandKind,
|
||||||
|
type CommandContext,
|
||||||
|
type SlashCommand,
|
||||||
|
} from './types.js';
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
import { MessageType, type HistoryItemAbout } from '../types.js';
|
import { MessageType, type HistoryItemAbout } from '../types.js';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Mock } from 'vitest';
|
import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest';
|
||||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
|
||||||
import { clearCommand } from './clearCommand.js';
|
import { clearCommand } from './clearCommand.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';
|
||||||
@@ -22,8 +21,7 @@ vi.mock('@google/gemini-cli-core', async () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
import type { GeminiClient } from '@google/gemini-cli-core';
|
import { uiTelemetryService, type GeminiClient } from '@google/gemini-cli-core';
|
||||||
import { uiTelemetryService } from '@google/gemini-cli-core';
|
|
||||||
|
|
||||||
describe('clearCommand', () => {
|
describe('clearCommand', () => {
|
||||||
let mockContext: CommandContext;
|
let mockContext: CommandContext;
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import {
|
|||||||
SessionStartSource,
|
SessionStartSource,
|
||||||
flushTelemetry,
|
flushTelemetry,
|
||||||
} from '@google/gemini-cli-core';
|
} from '@google/gemini-cli-core';
|
||||||
import type { SlashCommand } from './types.js';
|
import { CommandKind, type SlashCommand } from './types.js';
|
||||||
import { CommandKind } from './types.js';
|
|
||||||
import { MessageType } from '../types.js';
|
import { MessageType } from '../types.js';
|
||||||
import { randomUUID } from 'node:crypto';
|
import { randomUUID } from 'node:crypto';
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,8 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { HistoryItemCompression } from '../types.js';
|
import { MessageType, type HistoryItemCompression } from '../types.js';
|
||||||
import { MessageType } from '../types.js';
|
import { CommandKind, type SlashCommand } from './types.js';
|
||||||
import type { SlashCommand } from './types.js';
|
|
||||||
import { CommandKind } from './types.js';
|
|
||||||
|
|
||||||
export const compressCommand: SlashCommand = {
|
export const compressCommand: SlashCommand = {
|
||||||
name: 'compress',
|
name: 'compress',
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Mock } from 'vitest';
|
import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest';
|
||||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
|
||||||
import { copyCommand } from './copyCommand.js';
|
import { copyCommand } from './copyCommand.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';
|
||||||
|
|||||||
@@ -6,8 +6,11 @@
|
|||||||
|
|
||||||
import { debugLogger } from '@google/gemini-cli-core';
|
import { debugLogger } from '@google/gemini-cli-core';
|
||||||
import { copyToClipboard } from '../utils/commandUtils.js';
|
import { copyToClipboard } from '../utils/commandUtils.js';
|
||||||
import type { SlashCommand, SlashCommandActionReturn } from './types.js';
|
import {
|
||||||
import { CommandKind } from './types.js';
|
CommandKind,
|
||||||
|
type SlashCommand,
|
||||||
|
type SlashCommandActionReturn,
|
||||||
|
} from './types.js';
|
||||||
|
|
||||||
export const copyCommand: SlashCommand = {
|
export const copyCommand: SlashCommand = {
|
||||||
name: 'copy',
|
name: 'copy',
|
||||||
|
|||||||
@@ -4,8 +4,15 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
import {
|
||||||
import type { Mock } from 'vitest';
|
vi,
|
||||||
|
describe,
|
||||||
|
it,
|
||||||
|
expect,
|
||||||
|
beforeEach,
|
||||||
|
afterEach,
|
||||||
|
type Mock,
|
||||||
|
} from 'vitest';
|
||||||
import { directoryCommand } from './directoryCommand.js';
|
import { directoryCommand } from './directoryCommand.js';
|
||||||
import {
|
import {
|
||||||
expandHomeDir,
|
expandHomeDir,
|
||||||
|
|||||||
@@ -9,16 +9,21 @@ import {
|
|||||||
loadTrustedFolders,
|
loadTrustedFolders,
|
||||||
} from '../../config/trustedFolders.js';
|
} from '../../config/trustedFolders.js';
|
||||||
import { MultiFolderTrustDialog } from '../components/MultiFolderTrustDialog.js';
|
import { MultiFolderTrustDialog } from '../components/MultiFolderTrustDialog.js';
|
||||||
import type { SlashCommand, CommandContext } from './types.js';
|
import {
|
||||||
import { CommandKind } from './types.js';
|
CommandKind,
|
||||||
|
type SlashCommand,
|
||||||
|
type CommandContext,
|
||||||
|
} from './types.js';
|
||||||
import { MessageType, type HistoryItem } from '../types.js';
|
import { MessageType, type HistoryItem } from '../types.js';
|
||||||
import { refreshServerHierarchicalMemory } from '@google/gemini-cli-core';
|
import {
|
||||||
|
refreshServerHierarchicalMemory,
|
||||||
|
type Config,
|
||||||
|
} from '@google/gemini-cli-core';
|
||||||
import {
|
import {
|
||||||
expandHomeDir,
|
expandHomeDir,
|
||||||
getDirectorySuggestions,
|
getDirectorySuggestions,
|
||||||
batchAddDirectories,
|
batchAddDirectories,
|
||||||
} from '../utils/directoryUtils.js';
|
} from '../utils/directoryUtils.js';
|
||||||
import type { Config } from '@google/gemini-cli-core';
|
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,9 @@
|
|||||||
|
|
||||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||||
import { helpCommand } from './helpCommand.js';
|
import { helpCommand } from './helpCommand.js';
|
||||||
import { type CommandContext } from './types.js';
|
import { CommandKind, type CommandContext } from './types.js';
|
||||||
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
||||||
import { MessageType } from '../types.js';
|
import { MessageType } from '../types.js';
|
||||||
import { CommandKind } from './types.js';
|
|
||||||
|
|
||||||
describe('helpCommand', () => {
|
describe('helpCommand', () => {
|
||||||
let mockContext: CommandContext;
|
let mockContext: CommandContext;
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { SlashCommand } from './types.js';
|
import { CommandKind, type SlashCommand } from './types.js';
|
||||||
import { CommandKind } from './types.js';
|
|
||||||
import { MessageType, type HistoryItemHelp } from '../types.js';
|
import { MessageType, type HistoryItemHelp } from '../types.js';
|
||||||
|
|
||||||
export const helpCommand: SlashCommand = {
|
export const helpCommand: SlashCommand = {
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||||
import { hooksCommand } from './hooksCommand.js';
|
import { hooksCommand } from './hooksCommand.js';
|
||||||
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
||||||
import type { HookRegistryEntry } from '@google/gemini-cli-core';
|
import {
|
||||||
import { HookType, HookEventName, ConfigSource } from '@google/gemini-cli-core';
|
HookType,
|
||||||
|
HookEventName,
|
||||||
|
ConfigSource,
|
||||||
|
type HookRegistryEntry,
|
||||||
|
} from '@google/gemini-cli-core';
|
||||||
import type { CommandContext } from './types.js';
|
import type { CommandContext } from './types.js';
|
||||||
import { SettingScope } from '../../config/settings.js';
|
import { SettingScope } from '../../config/settings.js';
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,15 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { MockInstance } from 'vitest';
|
import {
|
||||||
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
vi,
|
||||||
|
describe,
|
||||||
|
it,
|
||||||
|
expect,
|
||||||
|
beforeEach,
|
||||||
|
afterEach,
|
||||||
|
type MockInstance,
|
||||||
|
} from 'vitest';
|
||||||
import { ideCommand } from './ideCommand.js';
|
import { ideCommand } from './ideCommand.js';
|
||||||
import { type CommandContext } from './types.js';
|
import { type CommandContext } from './types.js';
|
||||||
import { IDE_DEFINITIONS } from '@google/gemini-cli-core';
|
import { IDE_DEFINITIONS } from '@google/gemini-cli-core';
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Mock } from 'vitest';
|
import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest';
|
||||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
|
||||||
import { memoryCommand } from './memoryCommand.js';
|
import { memoryCommand } from './memoryCommand.js';
|
||||||
import type { SlashCommand, CommandContext } from './types.js';
|
import type { SlashCommand, CommandContext } from './types.js';
|
||||||
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ import {
|
|||||||
showMemory,
|
showMemory,
|
||||||
} from '@google/gemini-cli-core';
|
} from '@google/gemini-cli-core';
|
||||||
import { MessageType } from '../types.js';
|
import { MessageType } from '../types.js';
|
||||||
import type { SlashCommand, SlashCommandActionReturn } from './types.js';
|
import {
|
||||||
import { CommandKind } from './types.js';
|
CommandKind,
|
||||||
|
type SlashCommand,
|
||||||
|
type SlashCommandActionReturn,
|
||||||
|
} from './types.js';
|
||||||
|
|
||||||
export const memoryCommand: SlashCommand = {
|
export const memoryCommand: SlashCommand = {
|
||||||
name: 'memory',
|
name: 'memory',
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { OpenDialogActionReturn, SlashCommand } from './types.js';
|
import {
|
||||||
import { CommandKind } from './types.js';
|
CommandKind,
|
||||||
|
type OpenDialogActionReturn,
|
||||||
|
type SlashCommand,
|
||||||
|
} from './types.js';
|
||||||
|
|
||||||
export const privacyCommand: SlashCommand = {
|
export const privacyCommand: SlashCommand = {
|
||||||
name: 'privacy',
|
name: 'privacy',
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { OpenDialogActionReturn, SlashCommand } from './types.js';
|
import {
|
||||||
import { CommandKind } from './types.js';
|
CommandKind,
|
||||||
|
type OpenDialogActionReturn,
|
||||||
|
type SlashCommand,
|
||||||
|
} from './types.js';
|
||||||
|
|
||||||
export const settingsCommand: SlashCommand = {
|
export const settingsCommand: SlashCommand = {
|
||||||
name: 'settings',
|
name: 'settings',
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import {
|
|||||||
} from './setupGithubCommand.js';
|
} from './setupGithubCommand.js';
|
||||||
import type { CommandContext } from './types.js';
|
import type { CommandContext } from './types.js';
|
||||||
import * as commandUtils from '../utils/commandUtils.js';
|
import * as commandUtils from '../utils/commandUtils.js';
|
||||||
import type { ToolActionReturn } from '@google/gemini-cli-core';
|
import { debugLogger, type ToolActionReturn } from '@google/gemini-cli-core';
|
||||||
import { debugLogger } from '@google/gemini-cli-core';
|
|
||||||
|
|
||||||
vi.mock('child_process');
|
vi.mock('child_process');
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,11 @@ import {
|
|||||||
getGitHubRepoInfo,
|
getGitHubRepoInfo,
|
||||||
} from '../../utils/gitUtils.js';
|
} from '../../utils/gitUtils.js';
|
||||||
|
|
||||||
import type { SlashCommand, SlashCommandActionReturn } from './types.js';
|
import {
|
||||||
import { CommandKind } from './types.js';
|
CommandKind,
|
||||||
|
type SlashCommand,
|
||||||
|
type SlashCommandActionReturn,
|
||||||
|
} from './types.js';
|
||||||
import { getUrlOpenCommand } from '../../ui/utils/commandUtils.js';
|
import { getUrlOpenCommand } from '../../ui/utils/commandUtils.js';
|
||||||
import { debugLogger } from '@google/gemini-cli-core';
|
import { debugLogger } from '@google/gemini-cli-core';
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { SlashCommand } from './types.js';
|
import { CommandKind, type SlashCommand } from './types.js';
|
||||||
import { CommandKind } from './types.js';
|
|
||||||
|
|
||||||
export const shortcutsCommand: SlashCommand = {
|
export const shortcutsCommand: SlashCommand = {
|
||||||
name: 'shortcuts',
|
name: 'shortcuts',
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { SlashCommand } from './types.js';
|
import { CommandKind, type SlashCommand } from './types.js';
|
||||||
import { CommandKind } from './types.js';
|
|
||||||
import { terminalSetup } from '../utils/terminalSetup.js';
|
import { terminalSetup } from '../utils/terminalSetup.js';
|
||||||
import { type MessageActionReturn } from '@google/gemini-cli-core';
|
import { type MessageActionReturn } from '@google/gemini-cli-core';
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { OpenDialogActionReturn, SlashCommand } from './types.js';
|
import {
|
||||||
import { CommandKind } from './types.js';
|
CommandKind,
|
||||||
|
type OpenDialogActionReturn,
|
||||||
|
type SlashCommand,
|
||||||
|
} from './types.js';
|
||||||
|
|
||||||
export const themeCommand: SlashCommand = {
|
export const themeCommand: SlashCommand = {
|
||||||
name: 'theme',
|
name: 'theme',
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { vi } from 'vitest';
|
import { describe, it, expect, type vi } from 'vitest';
|
||||||
import { describe, it, expect } from 'vitest';
|
|
||||||
import { toolsCommand } from './toolsCommand.js';
|
import { toolsCommand } from './toolsCommand.js';
|
||||||
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
||||||
import { MessageType } from '../types.js';
|
import { MessageType } from '../types.js';
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import {
|
|||||||
shouldLaunchBrowser,
|
shouldLaunchBrowser,
|
||||||
UPGRADE_URL_PAGE,
|
UPGRADE_URL_PAGE,
|
||||||
} from '@google/gemini-cli-core';
|
} from '@google/gemini-cli-core';
|
||||||
import type { SlashCommand } from './types.js';
|
import { CommandKind, type SlashCommand } from './types.js';
|
||||||
import { CommandKind } from './types.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command to open the upgrade page for Gemini Code Assist.
|
* Command to open the upgrade page for Gemini Code Assist.
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { SlashCommand } from './types.js';
|
import { CommandKind, type SlashCommand } from './types.js';
|
||||||
import { CommandKind } from './types.js';
|
|
||||||
|
|
||||||
export const vimCommand: SlashCommand = {
|
export const vimCommand: SlashCommand = {
|
||||||
name: 'vim',
|
name: 'vim',
|
||||||
|
|||||||
@@ -4,16 +4,16 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Config, AuthType } from '@google/gemini-cli-core';
|
|
||||||
import {
|
import {
|
||||||
debugLogger,
|
debugLogger,
|
||||||
OutputFormat,
|
OutputFormat,
|
||||||
ExitCodes,
|
ExitCodes,
|
||||||
getAuthTypeFromEnv,
|
getAuthTypeFromEnv,
|
||||||
|
type Config,
|
||||||
|
type AuthType,
|
||||||
} from '@google/gemini-cli-core';
|
} from '@google/gemini-cli-core';
|
||||||
import { USER_SETTINGS_PATH } from './config/settings.js';
|
import { USER_SETTINGS_PATH, type LoadedSettings } from './config/settings.js';
|
||||||
import { validateAuthMethod } from './config/auth.js';
|
import { validateAuthMethod } from './config/auth.js';
|
||||||
import { type LoadedSettings } from './config/settings.js';
|
|
||||||
import { handleError } from './utils/errors.js';
|
import { handleError } from './utils/errors.js';
|
||||||
import { runExitCleanup } from './utils/cleanup.js';
|
import { runExitCleanup } from './utils/cleanup.js';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user