@kya-os/cli
Version:
CLI for MCP-I setup and management
14 lines • 783 B
TypeScript
/**
* Atomic, symlink-safe file replace.
*
* For `mcpi dco`, the destination and its temp sibling live in the current
* working tree, which may be an untrusted cloned repo. A tracked symlink
* planted at the predictable `<path>.mcpi-tmp` sibling would otherwise make
* a plain writeFileSync follow it and clobber an arbitrary file the user can
* write. So: unlink any pre-existing temp (rmSync removes the link itself,
* never its target), then create it with O_EXCL (`wx`) so a planted or
* racing symlink makes the write fail closed instead of being followed.
* renameSync replaces the destination without following a symlink there.
*/
export declare function writeFileAtomicSafe(path: string, content: string, mode?: number): void;
//# sourceMappingURL=fs-safe.d.ts.map