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

Function getPlanSlug

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

Source from the content-addressed store, hash-verified

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

Callers 6

callFunction · 0.85
setupFunction · 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
setPlanSlugCacheEntryFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected