import type { SimpleGit } from 'simple-git'; import { type StructuredDiff } from './structured-diff.js'; import type { HookDispatcher } from '../hooks/dispatcher.js'; /** * Extract bare repo-relative conflict paths from a failed merge's message. * * The documented contract is PATHS, a conflict-resolution session seeds from * this list, so a `path:reason` entry is a product defect. Two real raw shapes * exist depending on the git/simple-git output pairing: * * 1. git's own informational lines, forwarded in the error message: * `CONFLICT (content): Merge conflict in ` * 2. simple-git's parsed merge-summary rendering (a merge rejection built * with no explicit message stringifies its summary): * `CONFLICTS: :[, :…]`, each entry is the * parsed conflict's `file:reason` pair (e.g. `shared.txt:content`), so * the `:` suffix must be stripped to recover the bare path. * * This is the FALLBACK route only, the merge handler prefers the structured * conflict entries the git library attaches to its rejection. Exported so * regression tests can pin both raw shapes as fixtures with no dependence on * the host's git version. */ export declare function conflictPathsFromMergeOutput(message: string): string[]; /** * GitService, Wraps simple-git with hook emission on all mutating operations. * * Read-only operations (status, branch, log, diff, blame) do NOT emit hooks. * Mutating operations (commit, push, pull, merge, checkout, stash, worktreeAdd, * worktreeRemove) emit Pre:git:, Post:git:, and Fail:git: events. */ export declare class GitService { /** * The `simple-git` instance, built on first use rather than in the * constructor. `simple-git` is an optionalDependency, and a static import * plus a constructor-time `simpleGit(...)` put the specifier on the module * graph of everything that reaches git integration, the daemon included, * so an absent optional package removed the process instead of the feature * (see utils/optional-dependency.ts). The promise is memoised, so the * instance is still built exactly once per service, and every method here * was already async, so no public signature changed. */ private gitClient; private hooks; private cwd; constructor(cwd: string, hooks?: HookDispatcher); /** * This service's git client. When `simple-git` is absent the await throws * an error naming it, which reaches the caller through the same path any * other git failure takes. */ private git; private makeEvent; private firePre; private firePost; private fireFail; status(): Promise>>; branch(): Promise<{ current: string; all: string[]; detached: boolean; }>; log(maxCount?: number): Promise>; diff(ref?: string): Promise; /** * The FULL working-tree diff (optionally vs a ref), parsed into structured * per-file/per-hunk form with no size cap, the diff-view serving path that * replaces consumer-side raw-text truncation. Read-only, no hooks emitted. */ diffStructured(ref?: string): Promise; /** diffBetween, structured and uncapped (see diffStructured). Read-only. */ diffBetweenStructured(before: string, after: string, files?: string[]): Promise; /** * Get the diff for a single file, optionally from the staging area. * Read-only, no hooks emitted. */ diffFile(filePath: string, staged: boolean): Promise; /** * Get the full diff between two refs, optionally scoped to specific files. * Read-only, no hooks emitted. */ diffBetween(before: string, after: string, files?: string[]): Promise; /** * Get the --stat summary between two refs. * Read-only, no hooks emitted. */ diffStat(before: string, after: string): Promise; blame(filePath: string): Promise>; add(files: string | string[]): Promise; addAll(): Promise; reset(files?: string | string[]): Promise; commit(message: string, options?: { amend?: boolean; noVerify?: boolean; fallbackIdentity?: { name: string; email: string; } | undefined; }): Promise<{ hash: string; summary: string; }>; checkout(branch: string, options?: { create?: boolean; }): Promise; merge(branch: string): Promise<{ success: boolean; conflicts?: string[]; }>; push(remote?: string, branch?: string, options?: { force?: boolean; }): Promise; pull(remote?: string, branch?: string): Promise; stash(action?: 'push' | 'pop' | 'list' | 'drop', message?: string): Promise; worktreeAdd(path: string, branch: string): Promise; worktreeRemove(path: string): Promise; worktreeList(): Promise>; /** * Initialize a new git repository at the given path using Bun.spawnSync. * Returns true on success, false on failure. */ static initRepo(cwd: string): { success: boolean; error?: string; }; /** * Return true if the given directory is inside a git repository. * Uses `git rev-parse --git-dir` which exits 0 only inside a repo. */ static isGitRepo(cwd: string): boolean; static getRepoRoot(cwd: string): string | null; /** Return the working directory this instance is bound to. */ getCwd(): string; /** Release resources tied to this git client instance. */ dispose(): void; } //# sourceMappingURL=service.d.ts.map