MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / getUpdateInfo

Function getUpdateInfo

src/utils/updateCheck.ts:117–128  ·  view source on GitHub ↗
(
  pkg: string,
  current: string,
)

Source from the content-addressed store, hash-verified

115 * we don't hammer the npm registry on every launch.
116 */
117export async function getUpdateInfo(
118 pkg: string,
119 current: string,
120): Promise<UpdateInfo> {
121 const cached = readCache();
122 if (cached && Date.now() - cached.checkedAt < CACHE_TTL_MS) {
123 return makeResult(current, cached.latest);
124 }
125 const latest = await fetchLatestNpmVersion(pkg);
126 if (latest !== null) writeCache(latest);
127 return makeResult(current, latest);
128}
129
130function makeResult(current: string, latest: string | null): UpdateInfo {
131 if (latest === null) {

Callers 1

mainFunction · 0.85

Calls 4

readCacheFunction · 0.85
makeResultFunction · 0.85
fetchLatestNpmVersionFunction · 0.85
writeCacheFunction · 0.85

Tested by

no test coverage detected