/** * Temporary path name helpers for atomic upload (.tmp.) */ /** * Build a temp filename next to the target path, on the same FS, * so a final rename() stays atomic and avoids EXDEV. * * /etc/nginx/site.conf → /etc/nginx/.upload-.site.conf */ export declare function buildTempPath(remotePath: string): string; /** * Name for a deferred old copy next to the target. * * /var/www/app → /var/www/.bak-.app * * The random suffix is mandatory: with a fixed `.bak`, a re-install with a * copy left over from a previous crash would move the live directory inside * it, and the next step would routinely delete everything together. */ export declare function buildBackupPath(path: string): string; /** Temp name prefixes — used to recognize our own traces next to the target */ export declare const ARTIFACT_PREFIXES: string[]; /** * Restore the path the human named, in the text. * * Data travels under a temp name next to the target, and that name was * leaking into error messages: the human asked to write `/etc/nginx.conf`, * and the rejection came back about `/etc/.upload-7952b8939bc0.nginx.conf` * — a path they never named and can no longer find on the server. * * The temp path gets a note rather than simply losing its suffix: both * paths end up next to each other on one line, and without the note, the * substitution turns the `mv` of the staged copy onto the target into a * meaningless "rename the target to itself". * * The deferred copy (`.bak-`) doesn't fall under this rule: it stays on the * server, and we do tell the human its address — erasing it would turn "the * old copy wasn't cleaned up" into "failed to delete the live path". */ export declare function hideArtifactNames(text: string): string; /** * Whether a name looks like our temp path for this target. * * The check needs to be exact: the same directory can hold both unrelated * hidden files and our own temp paths for a **different** target. Calling * someone else's file ours means telling the human to delete the wrong one. */ export declare function isArtifactOf(name: string, base: string): boolean; /** * Build a remote /tmp staging path used for sudo uploads * (sftp under user, then sudo install/move into the protected dir). */ export declare function buildSudoStagingPath(): string;