Skip to content

Add config-based excludePrefixes to PeerStorage for path-level sync exclusion #60

Description

@pike00

Summary

The bridge currently has no built-in mechanism to exclude specific paths from sync. The only exclusion option is .syncignore, which lives inside the vault — awkward when the vault itself is the thing being synced and you want to exclude paths without modifying the vault contents.

Proposed feature

Add an optional excludePrefixes field to PeerStorageConf that accepts an array of posix-relative path prefixes (e.g. ["Photos", "Finance/Ledger", ".git"]). Paths matching any prefix are excluded from both:

  1. Live dispatch (dispatch / dispatchDeleted): early-return before reading or processing the file.
  2. Offline walk (scanOfflineChanges): passed as skip regexes to Deno's walk() so excluded trees are never traversed at all.

types.ts — add optional field

 export interface PeerStorageConf {
     group?: string;
     name: string;
     baseDir: string;
+    excludePrefixes?: string[];
     processor?: {
         cmd: string,
         args: string[]

PeerStorage.ts — add isExcludedPath() and integrate

isExcludedPath(posixRelPath: string): boolean {
    const prefixes = this.config.excludePrefixes ?? [];
    return prefixes.some(p => {
        const norm = p.replace(/^\/+|\/+$/g, "");
        return posixRelPath === norm || posixRelPath.startsWith(norm + "/");
    });
}

Call at the top of dispatch() and dispatchDeleted(). For the offline walk, build regexes from the prefixes and pass them to walk(lP, { skip: excludeRegexes }).

Rationale

  • Complements .syncignore without requiring a file inside the vault.
  • Essential for native (non-Docker) deployments that cannot use Docker volume masking for exclusion.
  • The offline walk skip is an optimization — excluded trees are never traversed, reducing scan time and memory.

Related

This feature is used by the deletion reconcile step proposed in the scanOfflineChanges enhancement (issue #59) to avoid tombstoning paths that are intentionally excluded from sync.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions