MCPcopy
hub / github.com/21st-dev/1code / stat

Function stat

src/main/lib/git/security/secure-fs.ts:397–402  ·  view source on GitHub ↗

* Get file stats within a worktree. * * Uses `stat` (follows symlinks) to get the real file size. * Validates that the resolved path stays within the worktree boundary.

(worktreePath: string, filePath: string)

Source from the content-addressed store, hash-verified

395 * Validates that the resolved path stays within the worktree boundary.
396 */
397 async stat(worktreePath: string, filePath: string): Promise<Stats> {
398 assertRegisteredWorktree(worktreePath);
399 const fullPath = resolvePathInWorktree(worktreePath, filePath);
400 await assertRealpathInWorktree(worktreePath, fullPath);
401 return stat(fullPath);
402 },
403
404 /**
405 * Get file stats without following symlinks.

Callers 6

repoUsesLfsFunction · 0.85
cleanStaleLockFilesFunction · 0.85
existsFunction · 0.85
files.tsFile · 0.85
shouldRotateLogFunction · 0.85
cleanupOldLogsFunction · 0.85

Calls 3

assertRegisteredWorktreeFunction · 0.90
resolvePathInWorktreeFunction · 0.90
assertRealpathInWorktreeFunction · 0.85

Tested by

no test coverage detected