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

Function printResumeHint

src/utils/gracefulShutdown.ts:144–184  ·  view source on GitHub ↗

* Print a hint about how to resume the session. * Only shown for interactive sessions with persistence enabled.

()

Source from the content-addressed store, hash-verified

142 * Only shown for interactive sessions with persistence enabled.
143 */
144function printResumeHint(): void {
145 // Only print once (failsafe timer may call this again after normal shutdown)
146 if (resumeHintPrinted) {
147 return
148 }
149 // Only show with TTY, interactive sessions, and persistence
150 if (
151 process.stdout.isTTY &&
152 getIsInteractive() &&
153 !isSessionPersistenceDisabled()
154 ) {
155 try {
156 const sessionId = getSessionId()
157 // Don't show resume hint if no session file exists (e.g., subcommands like `claude update`)
158 if (!sessionIdExists(sessionId)) {
159 return
160 }
161 const customTitle = getCurrentSessionTitle(sessionId)
162
163 // Use custom title if available, otherwise fall back to session ID
164 let resumeArg: string
165 if (customTitle) {
166 // Wrap in double quotes, escape backslashes first then quotes
167 const escaped = customTitle.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
168 resumeArg = `"${escaped}"`
169 } else {
170 resumeArg = sessionId
171 }
172
173 writeSync(
174 1,
175 chalk.dim(
176 `\nResume this session with:\nclaude --resume ${resumeArg}\n`,
177 ),
178 )
179 resumeHintPrinted = true
180 } catch {
181 // Ignore write errors
182 }
183 }
184}
185/* eslint-enable custom-rules/no-sync-fs */
186
187/**

Callers 2

gracefulShutdownSyncFunction · 0.85
gracefulShutdownFunction · 0.85

Calls 5

getIsInteractiveFunction · 0.85
getSessionIdFunction · 0.85
sessionIdExistsFunction · 0.85
getCurrentSessionTitleFunction · 0.85

Tested by

no test coverage detected