MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / refreshShellIndex

Function refreshShellIndex

desktop/pi-threads/shell-index.ts:60–84  ·  view source on GitHub ↗
(
  cwd: string,
  options: { emitRefreshEvent?: boolean | undefined; force?: boolean | undefined } = {},
)

Source from the content-addressed store, hash-verified

58}
59
60export async function refreshShellIndex(
61 cwd: string,
62 options: { emitRefreshEvent?: boolean | undefined; force?: boolean | undefined } = {},
63) {
64 const inFlightSync = inFlightShellIndexSyncs.get(cwd)
65 if (inFlightSync && !options.force) {
66 return await inFlightSync
67 }
68
69 if (inFlightSync) {
70 // User-triggered project import needs a fresh filesystem pass. The background
71 // startup sync may have snapshotted sessions before a Pi CLI project was created.
72 await inFlightSync
73
74 const forcedInFlightSync = inFlightShellIndexSyncs.get(cwd)
75 if (forcedInFlightSync) {
76 return await forcedInFlightSync
77 }
78 }
79
80 return await startShellIndexSync(cwd, {
81 emitRefreshEvent: options.emitRefreshEvent,
82 warningLabel: 'Failed to refresh shell index.',
83 })
84}

Callers 1

Calls 2

startShellIndexSyncFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected