perf(cli): cache loadSettings to reduce redundant disk I/O at startup (#21521)

This commit is contained in:
Sehoon Shon
2026-03-09 17:33:16 -04:00
committed by GitHub
parent ab64b15d51
commit 1fd42802be
6 changed files with 295 additions and 130 deletions
@@ -81,6 +81,7 @@ import {
loadSettings,
USER_SETTINGS_PATH,
type LoadedSettings,
resetSettingsCacheForTesting,
} from './settings.js';
const MOCK_WORKSPACE_DIR = '/mock/workspace';
@@ -88,6 +89,7 @@ const MOCK_WORKSPACE_DIR = '/mock/workspace';
describe('Settings Validation Warning', () => {
beforeEach(() => {
vi.clearAllMocks();
resetSettingsCacheForTesting();
(fs.readFileSync as Mock).mockReturnValue('{}');
(fs.existsSync as Mock).mockReturnValue(false);
});