feat(core): Add --skip-next-speaker-check flag (#6589)

This commit is contained in:
Sandy Tao 2025-08-19 16:45:13 -07:00 committed by GitHub
parent faff1c2ec7
commit 389102ec0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 0 deletions

View File

@ -229,6 +229,7 @@ export async function parseArguments(): Promise<CliArgs> {
// Handle comma-separated values
dirs.flatMap((dir) => dir.split(',').map((d) => d.trim())),
})
.check((argv) => {
if (argv.prompt && argv['promptInteractive']) {
throw new Error(
@ -540,6 +541,7 @@ export async function loadCliConfig(
interactive,
trustedFolder,
shouldUseNodePtyShell: settings.shouldUseNodePtyShell,
skipNextSpeakerCheck: settings.skipNextSpeakerCheck,
});
}

View File

@ -515,6 +515,15 @@ export const SETTINGS_SCHEMA = {
description: 'Show line numbers in the chat.',
showInDialog: true,
},
skipNextSpeakerCheck: {
type: 'boolean',
label: 'Skip Next Speaker Check',
category: 'General',
requiresRestart: false,
default: false,
description: 'Skip the next speaker check.',
showInDialog: true,
},
} as const;
type InferSettings<T extends SettingsSchema> = {

View File

@ -203,6 +203,7 @@ export interface ConfigParameters {
interactive?: boolean;
trustedFolder?: boolean;
shouldUseNodePtyShell?: boolean;
skipNextSpeakerCheck?: boolean;
}
export class Config {
@ -269,6 +270,7 @@ export class Config {
private readonly interactive: boolean;
private readonly trustedFolder: boolean | undefined;
private readonly shouldUseNodePtyShell: boolean;
private readonly skipNextSpeakerCheck: boolean;
private initialized: boolean = false;
constructor(params: ConfigParameters) {
@ -337,6 +339,7 @@ export class Config {
this.interactive = params.interactive ?? false;
this.trustedFolder = params.trustedFolder;
this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ?? false;
this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? false;
if (params.contextFileName) {
setGeminiMdFilename(params.contextFileName);
@ -735,6 +738,10 @@ export class Config {
return this.shouldUseNodePtyShell;
}
getSkipNextSpeakerCheck(): boolean {
return this.skipNextSpeakerCheck;
}
async getGitService(): Promise<GitService> {
if (!this.gitService) {
this.gitService = new GitService(this.targetDir);

View File

@ -209,6 +209,7 @@ describe('Gemini Client (client.ts)', () => {
getGeminiClient: vi.fn(),
setFallbackMode: vi.fn(),
getChatCompression: vi.fn().mockReturnValue(undefined),
getSkipNextSpeakerCheck: vi.fn().mockReturnValue(false),
};
const MockedConfig = vi.mocked(Config, true);
MockedConfig.mockImplementation(

View File

@ -527,6 +527,10 @@ export class GeminiClient {
return turn;
}
if (this.config.getSkipNextSpeakerCheck()) {
return turn;
}
const nextSpeakerCheck = await checkNextSpeaker(
this.getChat(),
this,