chore(desktop): name the bootstrap cache key and ref policy accurately

cachedScriptPath takes a cache key (often branch-main), not a commit, and
downloadInstallScript now receives the branch for existing checkouts too.
This commit is contained in:
kshitijk4poor
2026-09-28 12:26:57 +05:30
committed by kshitij
parent 82cff2ed43
commit 5912ed81ed

View File

@@ -220,15 +220,14 @@ function hasExistingGitCheckout(activeRoot) {
}
}
function cachedScriptPath(hermesHome, commit) {
return path.join(bootstrapCacheDir(hermesHome), `install-${commit}.${process.platform === 'win32' ? 'ps1' : 'sh'}`)
function cachedScriptPath(hermesHome, cacheKey) {
return path.join(bootstrapCacheDir(hermesHome), `install-${cacheKey}.${process.platform === 'win32' ? 'ps1' : 'sh'}`)
}
function downloadInstallScript(ref, destPath) {
// Fetch from GitHub raw at the install ref. Normal production builds pass a
// pinned SHA (immutable). Non-git fallback builds pass an unpinned branch
// ref so local builds can still bootstrap without pretending the all-zero
// placeholder is a real GitHub commit.
// Fetch from GitHub raw at the install ref: the packaged SHA for a fresh
// install, the branch for an existing checkout or a non-git fallback stamp
// (never the all-zero placeholder, which is not a real GitHub commit).
const scriptName = installScriptName()
const url = `https://raw.githubusercontent.com/NousResearch/hermes-agent/${ref}/scripts/${scriptName}`