MCPcopy
hub / github.com/garrytan/gstack / copyDirSync

Function copyDirSync

lib/worktree.ts:39–52  ·  view source on GitHub ↗

Recursive directory copy (pure TypeScript, no external deps).

(src: string, dest: string)

Source from the content-addressed store, hash-verified

37
38/** Recursive directory copy (pure TypeScript, no external deps). */
39function copyDirSync(src: string, dest: string): void {
40 fs.mkdirSync(dest, { recursive: true });
41 for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
42 // Skip symlinks to avoid infinite recursion (e.g., .claude/skills/gstack → repo root)
43 if (entry.isSymbolicLink()) continue;
44 const srcPath = path.join(src, entry.name);
45 const destPath = path.join(dest, entry.name);
46 if (entry.isDirectory()) {
47 copyDirSync(srcPath, destPath);
48 } else {
49 fs.copyFileSync(srcPath, destPath);
50 }
51 }
52}
53
54/** Run a git command and return stdout. Throws on failure unless tolerateFailure is set. */
55function git(args: string[], cwd: string, tolerateFailure = false): string {

Callers 1

createMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected