Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
@monochromatic-dev/dev-script-backup-path #
Copies a file or directory into ./bak/<timestamp>/,
preserving file
timestamps.
Useful before destructive edits to a path you do not want
to lose.
What it does #
- Takes one positional argument: the path to back up.
- Logs
Backing up <path>to stdout. - Computes a timestamp from
new Date().toISOString()with colons stripped (e.g.2026-05-14T061711.030Z). - Creates
./bak/<timestamp>/relative to the current working directory. - Recursively copies the source into
./bak/<timestamp>/<basename>, preserving file mtimes and atimes and erroring if the destination already exists.
Usage #
Run directly against the source:
node package/dev-script/backup-path/src/index.ts ./some/file-or-dir
Or against the built output once the package is installed as a workspace dependency:
node node_modules/@monochromatic-dev/dev-script-backup-path/dist/final/node/index.js ./some/file-or-dir
There is no mise run task wrapper;
invoke node directly.
Arguments #
- positional
<path>: file or directory to back up. Required. --help: print usage and exit.
No environment variables are read.
Quirks #
./bak/is not auto-created. The internalmkdir('bak/<timestamp>')call runs withoutrecursive: true, so a missing./bak/parent fails withENOENT: no such file or directory, mkdir 'bak/...'. Runmkdir bakonce in the working directory on first use.- Destination existence is rejected via
errorOnExist: true. The millisecond-resolution timestamp prevents this from firing under normal serial use; back-to-back invocations within the same millisecond would collide. - The copy uses Node's
fs.cpwithpreserveTimestamps: true. File permissions and ownership follow the platform default of that API and are not explicitly preserved.