Merge tag 'v0.3.0' into chore/sync-gemini-cli-v0.3.0

This commit is contained in:
mingholy.lmh
2025-09-10 21:01:40 +08:00
583 changed files with 30160 additions and 10770 deletions

View File

@@ -26,6 +26,7 @@ vi.mock('node:process', () => {
const mockProcess: Partial<NodeJS.Process> = {
exit: mockProcessExit,
platform: 'sunos',
cwd: () => '/fake/dir',
} as unknown as NodeJS.Process;
return {
...mockProcess,
@@ -66,25 +67,26 @@ vi.mock('../../utils/cleanup.js', () => ({
runExitCleanup: mockRunExitCleanup,
}));
import {
SlashCommandStatus,
ToolConfirmationOutcome,
makeFakeConfig,
} from '@qwen-code/qwen-code-core';
import { act, renderHook, waitFor } from '@testing-library/react';
import { beforeEach, describe, expect, it, vi, type Mock } from 'vitest';
import { LoadedSettings } from '../../config/settings.js';
import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest';
import { useSlashCommandProcessor } from './slashCommandProcessor.js';
import type {
CommandContext,
ConfirmShellCommandsActionReturn,
SlashCommand,
} from '../commands/types.js';
import { CommandKind } 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 {
CommandContext,
CommandKind,
ConfirmShellCommandsActionReturn,
SlashCommand,
} from '../commands/types.js';
import { MessageType } from '../types.js';
import { useSlashCommandProcessor } from './slashCommandProcessor.js';
SlashCommandStatus,
makeFakeConfig,
ToolConfirmationOutcome,
type IdeClient,
} from '@qwen-code/qwen-code-core';
function createTestCommand(
overrides: Partial<SlashCommand>,
@@ -107,6 +109,10 @@ describe('useSlashCommandProcessor', () => {
const mockSetQuittingMessages = vi.fn();
const mockConfig = makeFakeConfig({});
vi.spyOn(mockConfig, 'getIdeClient').mockReturnValue({
addStatusChangeListener: vi.fn(),
removeStatusChangeListener: vi.fn(),
} as unknown as IdeClient);
const mockSettings = {} as LoadedSettings;
@@ -146,6 +152,7 @@ describe('useSlashCommandProcessor', () => {
vi.fn(), // openSettingsDialog
vi.fn(), // toggleVimEnabled
setIsProcessing,
vi.fn(), // setGeminiMdFileCount
),
);
@@ -483,7 +490,7 @@ describe('useSlashCommandProcessor', () => {
description: 'A command from a file',
action: async () => ({
type: 'submit_prompt',
content: 'The actual prompt from the TOML file.',
content: [{ text: 'The actual prompt from the TOML file.' }],
}),
},
CommandKind.FILE,
@@ -499,7 +506,7 @@ describe('useSlashCommandProcessor', () => {
expect(actionResult).toEqual({
type: 'submit_prompt',
content: 'The actual prompt from the TOML file.',
content: [{ text: 'The actual prompt from the TOML file.' }],
});
expect(mockAddItem).toHaveBeenCalledWith(
@@ -515,7 +522,7 @@ describe('useSlashCommandProcessor', () => {
description: 'A command from mcp',
action: async () => ({
type: 'submit_prompt',
content: 'The actual prompt from the mcp command.',
content: [{ text: 'The actual prompt from the mcp command.' }],
}),
},
CommandKind.MCP_PROMPT,
@@ -531,7 +538,7 @@ describe('useSlashCommandProcessor', () => {
expect(actionResult).toEqual({
type: 'submit_prompt',
content: 'The actual prompt from the mcp command.',
content: [{ text: 'The actual prompt from the mcp command.' }],
});
expect(mockAddItem).toHaveBeenCalledWith(