MCPcopy
hub / github.com/EveryInc/compound-engineering-plugin / backupFile

Function backupFile

src/utils/files.ts:4–15  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

2import path from "path"
3
4export async function backupFile(filePath: string): Promise<string | null> {
5 if (!(await pathExists(filePath))) return null
6
7 try {
8 const timestamp = new Date().toISOString().replace(/[:.]/g, "-")
9 const backupPath = `${filePath}.bak.${timestamp}`
10 await fs.copyFile(filePath, backupPath)
11 return backupPath
12 } catch {
13 return null
14 }
15}
16
17export async function pathExists(filePath: string): Promise<boolean> {
18 try {

Callers 4

writePiBundleFunction · 0.90
writeKiroBundleFunction · 0.90
writeCodexBundleFunction · 0.90
writeOpenCodeBundleFunction · 0.90

Calls 1

pathExistsFunction · 0.70

Tested by

no test coverage detected