import { type AutoSyncHandle, type AutoSyncOptions, type FileState } from './auto-sync.js'; export interface MountOptions { ignoredPatterns: string[]; readonlyPatterns: string[]; excludeDirs: string[]; /** * Optional agent name used in the _MOUNT_README.md "Agent:" line. * If omitted, the doc uses a generic "agent" value. */ agentName?: string; /** * Include the project's `.git` directory inside the mount with one-way * project→mount sync. Default: false (`.git` is excluded entirely, matching * historical behavior). * * When true: * - `.git` is copied into the mount on creation, so git commands work inside. * - Project-side changes under `.git/**` flow into the mount. * - Mount-side changes under `.git/**` do NOT flow back to the project, so * commits/branches the agent creates inside the mount stay sandboxed and * are discarded with the mount on cleanup. Push to a remote to keep them. */ includeGit?: boolean; /** * Include the built-in list of large cache/build output directories in * the mount exclusion set. Default: true. The `.git` directory remains * excluded unless `includeGit` is true, even when this is false. */ includeDefaultExcludeDirs?: boolean; /** * How the initial mount population enumerates project files. * * - `'walk'` (default): recursive directory walk honoring the exclude and * ignore rules. Copies every non-excluded file it encounters, including * gitignored build outputs and caches the default excludes don't cover. * - `'git'`: enumerate via `git ls-files --cached --others * --exclude-standard` — exactly the tracked plus untracked-unignored * set, so gitignored trees (nested caches, worktrees, build outputs at * any depth) never enter the mount. Exclude and ignore rules still apply * on top. Throws if the project is not a usable git checkout. * - `'auto'`: `'git'` when the project has a `.git`, no `.gitmodules`, and * `git ls-files` succeeds; silently falls back to `'walk'` otherwise. * * With `includeGit: true`, git-list population copies `.git` as one * timestamp-preserving bulk clone (copy-on-write where the filesystem * supports it) instead of walking it file-by-file. When any ignored or * readonly pattern targets `.git` itself, population falls back to * `'walk'` so those patterns keep applying inside `.git`. */ population?: 'walk' | 'git' | 'auto'; } export interface MountHandle { mountDir: string; initialFileCount?: number; initialMountDurationMs?: number; /** * Which population strategy actually ran (after `'auto'` resolution), or * `'reattach'` for handles from {@link attachMount}. */ population: 'git' | 'walk' | 'reattach'; syncBack(opts?: { signal?: AbortSignal; paths?: Iterable; }): Promise; /** * Start bidirectional auto-sync: watches both the mount and project trees * via @parcel/watcher and runs periodic full reconciles as a safety net, * with a slower cadence while watchers are healthy. Returns a handle you * must `stop()` before teardown. */ startAutoSync(opts?: AutoSyncOptions): AutoSyncHandle; cleanup(): void; } export declare function createMount(projectDir: string, mountDir: string, options: MountOptions): Promise; /** * Reattach to a mount directory a previous `createMount` populated (and a * previous session left behind) without wiping or re-copying anything. * * The caller owns correctness of the reuse: pass the same patterns the mount * was created with, and pass `initialState` from a prior * `AutoSyncHandle.exportState()` so the first reconcile can tell "unchanged * since last session" from "changed on one side" — without it, files deleted * from the project while the mount sat idle would be treated as new * mount-side creations and resurrected. Refuses directories that don't carry * the mount marker. */ export declare function attachMount(projectDir: string, mountDir: string, options: MountOptions & { initialState?: Record; }): Promise;