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

Function processOrphanedPluginVersion

src/utils/plugins/cacheUtils.ts:149–177  ·  view source on GitHub ↗
(
  versionPath: string,
  now: number,
)

Source from the content-addressed store, hash-verified

147}
148
149async function processOrphanedPluginVersion(
150 versionPath: string,
151 now: number,
152): Promise<void> {
153 const orphanedAtPath = getOrphanedAtPath(versionPath)
154
155 let orphanedAt: number
156 try {
157 orphanedAt = (await stat(orphanedAtPath)).mtimeMs
158 } catch (error) {
159 const code = getErrnoCode(error)
160 if (code === 'ENOENT') {
161 await markPluginVersionOrphaned(versionPath)
162 return
163 }
164 logForDebugging(`Failed to stat orphaned marker: ${versionPath}: ${error}`)
165 return
166 }
167
168 if (now - orphanedAt > CLEANUP_AGE_MS) {
169 try {
170 await rm(versionPath, { recursive: true, force: true })
171 } catch (error) {
172 logForDebugging(
173 `Failed to delete orphaned version: ${versionPath}: ${error}`,
174 )
175 }
176 }
177}
178
179async function removeIfEmpty(dirPath: string): Promise<void> {
180 if ((await readSubdirs(dirPath)).length === 0) {

Calls 6

getOrphanedAtPathFunction · 0.85
statFunction · 0.85
getErrnoCodeFunction · 0.85
logForDebuggingFunction · 0.85
rmFunction · 0.85

Tested by

no test coverage detected