Documentation
    Preparing search index...

    Per-root VCS manager for git-backed content versioning.

    Each VCS-enabled watch root gets its own VcsManager instance, which owns a throttled commit pipeline: file changes are batched, staged, committed (with optional AI-generated messages), and optionally pushed to a remote.

    Concurrency: only one commit is in-flight at a time per root. Index.lock contention is handled with exponential backoff retries (D10). Failed batches are always retained; a circuit breaker spaces out retries of a persistently failing root (#249).

    Index
    • Parameters

      • rootPath: string
      • config: {
            author?: { email: string; name: string };
            branch: string;
            circuitBreakerCooldownMs: number;
            commitMessage?: {
                apiKey?: string;
                enabled: boolean;
                model: string;
                provider: string;
            };
            commitThrottleMs: number;
            defaultAccessToken?: string;
            enabled: boolean;
            maxBatchSize: number;
            maxConsecutiveFailures: number;
            retention?: { maxAgeDays: number; maxVersions: number; squashCron: string };
            staleLockThresholdMs: number;
        }
        • Optionalauthor?: { email: string; name: string }

          Git commit author identity. Set per-repo during init.

          • email: string

            Author email for git commits.

          • name: string

            Author name for git commits.

        • branch: string

          Git branch name for VCS operations. SquashManager and startup recovery use this instead of dynamic detection.

        • circuitBreakerCooldownMs: number

          Circuit breaker cooldown in ms. Once tripped, pending files are retained (re-queued, never discarded) and a single half-open recovery attempt is allowed once this cooldown elapses — without requiring a new file-change event.

        • OptionalcommitMessage?: { apiKey?: string; enabled: boolean; model: string; provider: string }

          Commit message generation configuration.

          • OptionalapiKey?: string

            API key for commit message provider. Supports env var substitution.

          • enabled: boolean

            Whether AI-generated commit messages are enabled.

          • model: string

            AI model for commit message generation.

          • provider: string

            AI provider for commit message generation.

        • commitThrottleMs: number

          Throttle interval in milliseconds for batching commits.

        • OptionaldefaultAccessToken?: string

          Default git access token for all roots. Supports env var substitution.

        • enabled: boolean

          Whether VCS is enabled globally.

        • maxBatchSize: number

          Maximum number of files per commit batch.

        • maxConsecutiveFailures: number

          Circuit breaker: trip after this many consecutive commit failures.

        • Optionalretention?: { maxAgeDays: number; maxVersions: number; squashCron: string }

          Retention policy configuration.

          • maxAgeDays: number

            Maximum age in days for retained versions.

          • maxVersions: number

            Maximum number of versions to retain per file.

          • squashCron: string

            Cron expression for squash schedule.

        • staleLockThresholdMs: number

          Age in ms after which an index.lock is considered stale and force-removed.

      • logger: Logger
      • OptionalcommitMessageGenerator: CommitMessageGenerator
      • OptionalremoteUrl: string
      • OptionalaccessToken: string

      Returns VcsManager

    config: {
        author?: { email: string; name: string };
        branch: string;
        circuitBreakerCooldownMs: number;
        commitMessage?: {
            apiKey?: string;
            enabled: boolean;
            model: string;
            provider: string;
        };
        commitThrottleMs: number;
        defaultAccessToken?: string;
        enabled: boolean;
        maxBatchSize: number;
        maxConsecutiveFailures: number;
        retention?: { maxAgeDays: number; maxVersions: number; squashCron: string };
        staleLockThresholdMs: number;
    }

    Type Declaration

    • Optionalauthor?: { email: string; name: string }

      Git commit author identity. Set per-repo during init.

      • email: string

        Author email for git commits.

      • name: string

        Author name for git commits.

    • branch: string

      Git branch name for VCS operations. SquashManager and startup recovery use this instead of dynamic detection.

    • circuitBreakerCooldownMs: number

      Circuit breaker cooldown in ms. Once tripped, pending files are retained (re-queued, never discarded) and a single half-open recovery attempt is allowed once this cooldown elapses — without requiring a new file-change event.

    • OptionalcommitMessage?: { apiKey?: string; enabled: boolean; model: string; provider: string }

      Commit message generation configuration.

      • OptionalapiKey?: string

        API key for commit message provider. Supports env var substitution.

      • enabled: boolean

        Whether AI-generated commit messages are enabled.

      • model: string

        AI model for commit message generation.

      • provider: string

        AI provider for commit message generation.

    • commitThrottleMs: number

      Throttle interval in milliseconds for batching commits.

    • OptionaldefaultAccessToken?: string

      Default git access token for all roots. Supports env var substitution.

    • enabled: boolean

      Whether VCS is enabled globally.

    • maxBatchSize: number

      Maximum number of files per commit batch.

    • maxConsecutiveFailures: number

      Circuit breaker: trip after this many consecutive commit failures.

    • Optionalretention?: { maxAgeDays: number; maxVersions: number; squashCron: string }

      Retention policy configuration.

      • maxAgeDays: number

        Maximum age in days for retained versions.

      • maxVersions: number

        Maximum number of versions to retain per file.

      • squashCron: string

        Cron expression for squash schedule.

    • staleLockThresholdMs: number

      Age in ms after which an index.lock is considered stale and force-removed.

    remoteUrl: string | undefined
    rootPath: string
    • Signal that the initial filesystem scan is complete. Clears the baseline flag so subsequent commits use normal "watcher: batch" messages.

      Returns void

    • Add a file to the pending set and start the throttle timer. If the pending set reaches maxBatchSize, commit a batch immediately.

      The circuit breaker is intentionally not reset here: recovery is time-based, so a busy root cannot hammer a deterministic failure.

      Parameters

      • filePath: string

        Absolute path of the changed file.

      Returns void

    • Queue a deleted file. Staging records the deletion if git tracks it.

      Parameters

      • filePath: string

        Absolute path of the deleted file.

      Returns void

    • Pause the commit pipeline. Drains pending commits via flush(), then sets a flag that makes commitBatch queue instead of execute. Used by SquashManager to coordinate squash operations.

      Returns Promise<void>

    • Add tracked-but-deleted paths (git ls-files --deleted) in this manager's watch scope to pending, so the next commit (typically the baseline) records deletions that happened while nothing was watching. Called by the coordinator before flush/endBaseline on startup. See #249.

      Parameters

      • isInScope: (absolutePath: string) => boolean

        Returns true if the absolute path routes to this manager (the coordinator's routing and watch-scope logic).

      Returns Promise<void>

    • Resume the commit pipeline after a pause. Re-enables normal commit operations and starts a throttle timer if there are pending files that accumulated during the pause.

      Returns void

    • Begin accepting file changes. Sets the manager to started state and starts the squash manager if configured.

      Performs startup orphan detection/recovery before starting the squash manager, ensuring the repo is on the configured branch, and reports (never clears) an abandoned cherry-pick, rebase, or merge.

      Baseline mode (commit prefix "baseline:") remains active until endBaseline is called by the coordinator after the initial scan.

      Returns Promise<void>