MCPcopy
hub / github.com/codeaashu/claude-code / getPlanSlug

Function getPlanSlug

src/utils/plans.ts:32–49  ·  view source on GitHub ↗
(sessionId?: SessionId)

Source from the content-addressed store, hash-verified

30 * If a plan file with the generated slug already exists, retries up to 10 times.
31 */
32export function getPlanSlug(sessionId?: SessionId): string {
33 const id = sessionId ?? getSessionId()
34 const cache = getPlanSlugCache()
35 let slug = cache.get(id)
36 if (!slug) {
37 const plansDir = getPlansDirectory()
38 // Try to find a unique slug that doesn't conflict with existing files
39 for (let i = 0; i < MAX_SLUG_RETRIES; i++) {
40 slug = generateWordSlug()
41 const filePath = join(plansDir, `${slug}.md`)
42 if (!getFsImplementation().existsSync(filePath)) {
43 break
44 }
45 }
46 cache.set(id, slug!)
47 }
48 return slug!
49}
50
51/**
52 * Set a specific plan slug for a session (used when resuming a session)

Callers 6

setupFunction · 0.85
callFunction · 0.85
getPlanFilePathFunction · 0.85
copyPlanForForkFunction · 0.85
isSessionPlanFileFunction · 0.85
processInitialMessageFunction · 0.85

Calls 6

getSessionIdFunction · 0.85
getPlanSlugCacheFunction · 0.85
generateWordSlugFunction · 0.85
getFsImplementationFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected