Skip to content

Commit 6803559

Browse files
authored
feat(core): Enable ripgrep by default. (google-gemini#7427)
1 parent 557dba4 commit 6803559

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

packages/cli/src/config/config.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,28 +1645,28 @@ describe('loadCliConfig useRipgrep', () => {
16451645
vi.restoreAllMocks();
16461646
});
16471647

1648-
it('should be false by default when useRipgrep is not set in settings', async () => {
1648+
it('should be true by default when useRipgrep is not set in settings', async () => {
16491649
process.argv = ['node', 'script.js'];
16501650
const argv = await parseArguments({} as Settings);
16511651
const settings: Settings = {};
16521652
const config = await loadCliConfig(settings, [], 'test-session', argv);
1653-
expect(config.getUseRipgrep()).toBe(false);
1653+
expect(config.getUseRipgrep()).toBe(true);
16541654
});
16551655

1656-
it('should be true when useRipgrep is set to true in settings', async () => {
1656+
it('should be false when useRipgrep is set to false in settings', async () => {
16571657
process.argv = ['node', 'script.js'];
16581658
const argv = await parseArguments({} as Settings);
1659-
const settings: Settings = { tools: { useRipgrep: true } };
1659+
const settings: Settings = { tools: { useRipgrep: false } };
16601660
const config = await loadCliConfig(settings, [], 'test-session', argv);
1661-
expect(config.getUseRipgrep()).toBe(true);
1661+
expect(config.getUseRipgrep()).toBe(false);
16621662
});
16631663

1664-
it('should be false when useRipgrep is explicitly set to false in settings', async () => {
1664+
it('should be true when useRipgrep is explicitly set to true in settings', async () => {
16651665
process.argv = ['node', 'script.js'];
16661666
const argv = await parseArguments({} as Settings);
1667-
const settings: Settings = { tools: { useRipgrep: false } };
1667+
const settings: Settings = { tools: { useRipgrep: true } };
16681668
const config = await loadCliConfig(settings, [], 'test-session', argv);
1669-
expect(config.getUseRipgrep()).toBe(false);
1669+
expect(config.getUseRipgrep()).toBe(true);
16701670
});
16711671
});
16721672

packages/cli/src/config/settingsSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ const SETTINGS_SCHEMA = {
741741
label: 'Use Ripgrep',
742742
category: 'Tools',
743743
requiresRestart: false,
744-
default: false,
744+
default: true,
745745
description:
746746
'Use ripgrep for file content search instead of the fallback implementation. Provides faster search performance.',
747747
showInDialog: true,

packages/core/src/config/config.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -490,36 +490,36 @@ describe('Server Config (config.ts)', () => {
490490
});
491491

492492
describe('UseRipgrep Configuration', () => {
493-
it('should default useRipgrep to false when not provided', () => {
493+
it('should default useRipgrep to true when not provided', () => {
494494
const config = new Config(baseParams);
495-
expect(config.getUseRipgrep()).toBe(false);
495+
expect(config.getUseRipgrep()).toBe(true);
496496
});
497497

498-
it('should set useRipgrep to true when provided as true', () => {
498+
it('should set useRipgrep to false when provided as false', () => {
499499
const paramsWithRipgrep: ConfigParameters = {
500500
...baseParams,
501-
useRipgrep: true,
501+
useRipgrep: false,
502502
};
503503
const config = new Config(paramsWithRipgrep);
504-
expect(config.getUseRipgrep()).toBe(true);
504+
expect(config.getUseRipgrep()).toBe(false);
505505
});
506506

507-
it('should set useRipgrep to false when explicitly provided as false', () => {
507+
it('should set useRipgrep to true when explicitly provided as true', () => {
508508
const paramsWithRipgrep: ConfigParameters = {
509509
...baseParams,
510-
useRipgrep: false,
510+
useRipgrep: true,
511511
};
512512
const config = new Config(paramsWithRipgrep);
513-
expect(config.getUseRipgrep()).toBe(false);
513+
expect(config.getUseRipgrep()).toBe(true);
514514
});
515515

516-
it('should default useRipgrep to false when undefined', () => {
516+
it('should default useRipgrep to true when undefined', () => {
517517
const paramsWithUndefinedRipgrep: ConfigParameters = {
518518
...baseParams,
519519
useRipgrep: undefined,
520520
};
521521
const config = new Config(paramsWithUndefinedRipgrep);
522-
expect(config.getUseRipgrep()).toBe(false);
522+
expect(config.getUseRipgrep()).toBe(true);
523523
});
524524
});
525525

packages/core/src/config/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ export class Config {
390390
this.chatCompression = params.chatCompression;
391391
this.interactive = params.interactive ?? false;
392392
this.trustedFolder = params.trustedFolder;
393-
this.useRipgrep = params.useRipgrep ?? false;
393+
this.useRipgrep = params.useRipgrep ?? true;
394394
this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ?? false;
395395
this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? true;
396396
this.shellExecutionConfig = {

packages/core/src/core/subagent.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ vi.mock('../ide/ide-client.js');
4545

4646
async function createMockConfig(
4747
toolRegistryMocks = {},
48+
configParameters: Partial<ConfigParameters> = {},
4849
): Promise<{ config: Config; toolRegistry: ToolRegistry }> {
4950
const configParams: ConfigParameters = {
5051
sessionId: 'test-session',
5152
model: DEFAULT_GEMINI_MODEL,
5253
targetDir: '.',
5354
debugMode: false,
5455
cwd: process.cwd(),
56+
...configParameters,
5557
};
5658
const config = new Config(configParams);
5759
await config.initialize();
@@ -767,7 +769,7 @@ describe('subagent.ts', () => {
767769
// Use fake timers to reliably test timeouts
768770
vi.useFakeTimers();
769771

770-
const { config } = await createMockConfig();
772+
const { config } = await createMockConfig({}, { useRipgrep: false });
771773
const runConfig: RunConfig = { max_time_minutes: 5, max_turns: 100 };
772774

773775
// We need to control the resolution of the sendMessageStream promise to advance the timer during execution.
@@ -812,7 +814,7 @@ describe('subagent.ts', () => {
812814
});
813815

814816
it('should terminate with ERROR if the model call throws', async () => {
815-
const { config } = await createMockConfig();
817+
const { config } = await createMockConfig({}, { useRipgrep: false });
816818
mockSendMessageStream.mockRejectedValue(new Error('API Failure'));
817819

818820
const scope = await SubAgentScope.create(

0 commit comments

Comments
 (0)