MCPcopy Index your code
hub / github.com/codeaashu/claude-code / deletePluginCache

Function deletePluginCache

src/utils/plugins/installedPluginsManager.ts:965–996  ·  view source on GitHub ↗
(installPath: string)

Source from the content-addressed store, hash-verified

963export { getGitCommitSha }
964
965export function deletePluginCache(installPath: string): void {
966 const fs = getFsImplementation()
967
968 try {
969 fs.rmSync(installPath, { recursive: true, force: true })
970 logForDebugging(`Deleted plugin cache at ${installPath}`)
971
972 // Clean up empty parent plugin directory (cache/{marketplace}/{plugin})
973 // Versioned paths have structure: cache/{marketplace}/{plugin}/{version}
974 const cachePath = getPluginCachePath()
975 if (installPath.includes('/cache/') && installPath.startsWith(cachePath)) {
976 const pluginDir = dirname(installPath) // e.g., cache/{marketplace}/{plugin}
977 if (pluginDir !== cachePath && pluginDir.startsWith(cachePath)) {
978 try {
979 const contents = fs.readdirSync(pluginDir)
980 if (contents.length === 0) {
981 fs.rmdirSync(pluginDir)
982 logForDebugging(`Deleted empty plugin directory at ${pluginDir}`)
983 }
984 } catch {
985 // Parent dir doesn't exist or isn't readable — skip cleanup
986 }
987 }
988 }
989 } catch (error) {
990 const errorMsg = errorMessage(error)
991 logError(toError(error))
992 throw new Error(
993 `Failed to delete plugin cache at ${installPath}: ${errorMsg}`,
994 )
995 }
996}
997
998/**
999 * Get the git commit SHA from a git repository directory

Callers

nothing calls this directly

Calls 6

getFsImplementationFunction · 0.85
logForDebuggingFunction · 0.85
getPluginCachePathFunction · 0.85
toErrorFunction · 0.85
errorMessageFunction · 0.50
logErrorFunction · 0.50

Tested by

no test coverage detected