MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / touch

Method touch

src/mcp/explore-session-state.ts:289–304  ·  view source on GitHub ↗

* Fetch a project's state, creating it if new, and mark it most-recently-used. * Evicts the LRU project past the bound — dropping a project entirely (rather * than its detail) is right here: a session that has moved on to four other * repos is not about to re-ask the first one.

(key: string, projectRoot: string)

Source from the content-addressed store, hash-verified

287 * repos is not about to re-ask the first one.
288 */
289 private touch(key: string, projectRoot: string): MutableProjectState {
290 const existing = this.projects.get(key);
291 if (existing) {
292 this.projects.delete(key);
293 this.projects.set(key, existing);
294 return existing;
295 }
296 const created: MutableProjectState = { projectRoot, callCount: 0, responseBytes: 0, calls: [] };
297 this.projects.set(key, created);
298 while (this.projects.size > EXPLORE_SESSION_LIMITS.MAX_PROJECTS) {
299 const lru = this.projects.keys().next().value as string | undefined;
300 if (lru === undefined) break;
301 this.projects.delete(lru);
302 }
303 return created;
304 }
305
306 /**
307 * Normalize + bound one call's files: coalesce each file's ranges, then keep

Callers 1

recordMethod · 0.95

Calls 4

nextMethod · 0.80
getMethod · 0.65
deleteMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected