MCPcopy Index your code
hub / github.com/PatrickSys/codebase-context / normalizeMemoryScope

Function normalizeMemoryScope

src/memory/store.ts:31–54  ·  view source on GitHub ↗
(raw: unknown)

Source from the content-addressed store, hash-verified

29}
30
31export function normalizeMemoryScope(raw: unknown): MemoryScope | undefined {
32 if (!isRecord(raw)) return undefined;
33 const kind = raw.kind;
34 if (kind === 'global') {
35 return { kind };
36 }
37 if (kind === 'file' && typeof raw.file === 'string' && raw.file.trim()) {
38 return { kind, file: normalizePathLike(raw.file.trim()) };
39 }
40 if (
41 kind === 'symbol' &&
42 typeof raw.file === 'string' &&
43 raw.file.trim() &&
44 typeof raw.symbol === 'string' &&
45 raw.symbol.trim()
46 ) {
47 return {
48 kind,
49 file: normalizePathLike(raw.file.trim()),
50 symbol: raw.symbol.trim()
51 };
52 }
53 return undefined;
54}
55
56export function normalizeMemory(raw: unknown): Memory | null {
57 if (!isRecord(raw)) return null;

Callers 4

handleMemoryCliFunction · 0.85
handleFunction · 0.85
normalizeMemoryFunction · 0.85

Calls 2

isRecordFunction · 0.70
normalizePathLikeFunction · 0.70

Tested by

no test coverage detected