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

Function getRecordFilePath

src/utils/asciicast.ts:24–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22 * The path is computed once and cached in recordingState.
23 */
24export function getRecordFilePath(): string | null {
25 if (recordingState.filePath !== null) {
26 return recordingState.filePath
27 }
28 if (process.env.USER_TYPE !== 'ant') {
29 return null
30 }
31 if (!isEnvTruthy(process.env.CLAUDE_CODE_TERMINAL_RECORDING)) {
32 return null
33 }
34 // Record alongside the transcript.
35 // Each launch gets its own file so --continue produces multiple recordings.
36 const projectsDir = join(getClaudeConfigHomeDir(), 'projects')
37 const projectDir = join(projectsDir, sanitizePath(getOriginalCwd()))
38 recordingState.timestamp = Date.now()
39 recordingState.filePath = join(
40 projectDir,
41 `${getSessionId()}-${recordingState.timestamp}.cast`,
42 )
43 return recordingState.filePath
44}
45
46export function _resetRecordingStateForTesting(): void {
47 recordingState.filePath = null

Callers 1

installAsciicastRecorderFunction · 0.85

Calls 4

isEnvTruthyFunction · 0.85
getOriginalCwdFunction · 0.85
getSessionIdFunction · 0.85
sanitizePathFunction · 0.70

Tested by

no test coverage detected