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

Function detectSessionPatternType

src/utils/memoryFileDetection.ts:65–82  ·  view source on GitHub ↗
(
  pattern: string,
)

Source from the content-addressed store, hash-verified

63 * Used for Grep/Glob tools where we check patterns, not actual file paths.
64 */
65export function detectSessionPatternType(
66 pattern: string,
67): 'session_memory' | 'session_transcript' | null {
68 const normalized = pattern.split(win32.sep).join(posix.sep)
69 if (
70 normalized.includes('session-memory') &&
71 (normalized.includes('.md') || normalized.endsWith('*'))
72 ) {
73 return 'session_memory'
74 }
75 if (
76 normalized.includes('.jsonl') ||
77 (normalized.includes('projects') && normalized.includes('*.jsonl'))
78 ) {
79 return 'session_transcript'
80 }
81 return null
82}
83
84/**
85 * Check if a file path is within the memdir directory.

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected