MCPcopy Create free account
hub / github.com/google-gemini/gemini-cli / load

Method load

packages/cli/src/utils/persistentState.ts:34–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32 }
33
34 private load(): PersistentStateData {
35 if (this.cache) {
36 return this.cache;
37 }
38 try {
39 const filePath = this.getPath();
40 if (fs.existsSync(filePath)) {
41 const content = fs.readFileSync(filePath, 'utf-8');
42 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
43 this.cache = JSON.parse(content);
44 } else {
45 this.cache = {};
46 }
47 } catch (error) {
48 debugLogger.warn('Failed to load persistent state:', error);
49 // If error reading (e.g. corrupt JSON), start fresh
50 this.cache = {};
51 }
52 return this.cache!;
53 }
54
55 private save() {
56 if (!this.cache) return;

Callers 2

getMethod · 0.95
setMethod · 0.95

Calls 2

getPathMethod · 0.95
warnMethod · 0.45

Tested by

no test coverage detected