export interface LocalTreeEntry { relPath: string; kind: "file" | "symlink"; size: number; } export interface LocalTreeGitInfo { commit: string; dirty: boolean; } export interface LocalTreeArchive { archivePath: string; /** 64 lowercase hex sha256, the provenance pin (not the repo's 16-char display digest). */ archiveSha256: string; fileCount: number; totalBytes: number; /** Absent when root is not a git work tree. */ git?: LocalTreeGitInfo; } export interface CreateLocalTreeArchiveOptions { /** Default: a fresh directory under os.tmpdir(). */ outputPath?: string; /** Author-supplied path prefixes / basenames, on top of the always-on denylist. */ extraExclude?: string[]; /** Upload size cap. Default DEFAULT_LOCAL_TREE_MAX_ARCHIVE_BYTES (256 MiB). */ maxArchiveBytes?: number; } /** * Path segments that are always excluded, wherever they appear in a relPath, * in both git and fallback enumeration modes. Not overridable by callers. */ export declare const LOCAL_TREE_DENYLIST_PATH_SEGMENTS: readonly [".git", "node_modules", ".humanish", ".homun"]; /** * Basename glob patterns (single leading or trailing `*` only) that are always * excluded, in both git and fallback enumeration modes. Not overridable by * callers. This is a safety net for secret-shaped files that were never * gitignored; in git mode `.gitignore` already handles the bulk (build output, * caches). */ export declare const LOCAL_TREE_DENYLIST_BASENAME_PATTERNS: readonly [".env*", "*.pem", "*.key", "*.p12", "*.pfx", "id_rsa*", "id_dsa*", "id_ed25519*", "id_ecdsa*", "*.keystore", "*.jks", "*.ppk", "*.gpg", "*.tfstate", "terraform.tfstate.backup", ".npmrc", ".netrc", ".dockercfg", "kubeconfig", "credentials.json", "service-account.json", "serviceAccount.json", "service_account.json", "secrets.json", "secrets.yaml", "secrets.yml", "auth.json"]; /** Default upload size cap: 256 MiB. */ export declare const DEFAULT_LOCAL_TREE_MAX_ARCHIVE_BYTES: number; /** * Enumerate the packable entries of a local working tree. * * When root is a git work tree, the list is `git ls-files --cached --others * --exclude-standard -z`: tracked files plus untracked-but-not-ignored files, * honoring .gitignore exactly as git does. Entries that no longer exist on * disk (staged deletes) are dropped, and entries that resolve to a directory * on disk (a nested repo or worktree boundary) are dropped rather than * recursed into. * * Otherwise, a recursive readdir walk applies only the always-on denylist * plus extraExclude; .gitignore semantics require git, so this fallback is * coarser by design. * * The always-on denylist is applied in both modes and is not overridable. * The returned entries are sorted bytewise by relPath. */ export declare function enumerateLocalTree(root: string, options?: { extraExclude?: string[]; }): { entries: LocalTreeEntry[]; git?: LocalTreeGitInfo; }; /** * Enumerate a local working tree and pack it into a gzipped tar archive, * computing archiveSha256 from the exact same entries list used for the tar * file list. * * Fails closed when: the root is missing or not a directory; enumeration * produces zero entries; or total packed bytes exceed maxArchiveBytes. */ export declare function createLocalTreeArchive(root: string, options?: CreateLocalTreeArchiveOptions): LocalTreeArchive; /** * Normalize an author-supplied exclude entry to the relPath shape enumeration * produces (no leading "./", no trailing "/"). Absolute paths and glob syntax * are REJECTED, not silently no-op'd: an exclude the author believed in but * that never matches anything is a leak vector, so unusable shapes fail * closed at the packing boundary (and, for lab-config callers, already at * parse time). */ export declare function normalizeExtraExcludeEntry(entry: string): string;