@relayfile/local-mount 0.7.5 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@ interface MountHandle {
30
30
  `createMount` returns `Promise<MountHandle>`. The walker yields the event loop between directory entries so consumer-side timers (e.g. an `ora` spinner driven by `setInterval`) keep firing while the mount is being built.
31
31
 
32
32
  Behavior:
33
- - Copies regular files into the mount
33
+ - Copies regular files into the mount, requesting a filesystem reflink clone when the source and mount are on a compatible same-volume filesystem and falling back to a byte copy otherwise
34
34
  - Applies ignore rules from `ignoredPatterns`
35
35
  - Marks read-only matches as mode `0o444`
36
36
  - Excludes `.git`, `node_modules`, `.npm-cache`, and common build/cache output directories by default. Pass `includeGit: true` to opt the project's `.git` directory back in (see [Including `.git`](#including-git))
@@ -292,6 +292,8 @@ The mount is built by copying files rather than symlinking them. Symlinks would
292
292
 
293
293
  Source-side symlinks that resolve to regular files inside the project *are* followed when building the mount; the resolved bytes are copied. Symlinks the agent creates inside the mount are skipped on sync-back.
294
294
 
295
+ On filesystems that support copy-on-write clones (for example APFS on macOS and btrfs/xfs/zfs on Linux), initial mount creation requests a non-forcing reflink copy. This preserves the distinct inode and copy-on-write semantics required above while avoiding an up-front byte copy when `projectDir` and `mountDir` are on the same filesystem. Unsupported filesystems and cross-device mounts fall back to ordinary copies.
296
+
295
297
  ## Notes
296
298
 
297
299
  - Requires Node.js 18+
package/dist/mount.js CHANGED
@@ -1,4 +1,4 @@
1
- import { chmodSync, copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, } from 'node:fs';
1
+ import { chmodSync, constants as fsConstants, copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, } from 'node:fs';
2
2
  import ignore from 'ignore';
3
3
  import path from 'node:path';
4
4
  import { startAutoSync, } from './auto-sync.js';
@@ -216,7 +216,7 @@ function copyMountedFile(sourceRoot, mountDir, sourcePath, mountPath, relativePa
216
216
  if (!safeSourcePath) {
217
217
  return;
218
218
  }
219
- copyFileSync(safeSourcePath, safeMountPath);
219
+ copyFileSync(safeSourcePath, safeMountPath, fsConstants.COPYFILE_FICLONE);
220
220
  if (isPathMatched(relativePath, readonlyMatcher)) {
221
221
  chmodSync(safeMountPath, 0o444);
222
222
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relayfile/local-mount",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "Create a symlink/copy mount of a project directory with .agentignore/.agentreadonly semantics, then launch a CLI inside it and sync writable changes back on exit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",