MCPcopy Create free account
hub / github.com/backnotprop/plannotator / resolveFolderSourceFile

Function resolveFolderSourceFile

packages/shared/source-save-node.ts:83–99  ·  view source on GitHub ↗
(filePath: string, folderPath: string)

Source from the content-addressed store, hash-verified

81}
82
83export function resolveFolderSourceFile(filePath: string, folderPath: string): string | null {
84 if (!isSourceSaveFilePath(filePath)) return null;
85
86 let root: string;
87 let candidate: string;
88 try {
89 root = realpathSync(resolveUserPath(folderPath));
90 candidate = resolveUserPath(filePath, root);
91 if (!existsSync(candidate)) return null;
92 candidate = realpathSync(candidate);
93 } catch {
94 return null;
95 }
96
97 if (!isWithinProjectRoot(candidate, root)) return null;
98 return candidate;
99}
100
101export function resolveFolderSourceFileForSave(filePath: string, folderPath: string): string | null {
102 if (!isSourceSaveFilePath(filePath)) return null;

Callers 6

fetchFunction · 0.90
startAnnotateServerFunction · 0.85

Calls 3

isSourceSaveFilePathFunction · 0.90
resolveUserPathFunction · 0.90
isWithinProjectRootFunction · 0.90

Tested by

no test coverage detected