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
5 changed files with 23 additions and 0 deletions

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,