export { extractChangedFiles, filterDiffByPatterns, getDefaultBranch, getGitBranch, getGitBranchDiff, getGitDiff, getGitDiffRange, getGitDiffStat, getGitLogSince, getGitStatus, getLatestTag, getTagDate, isFileDirty, resolveGitRoot, } from '@mmnto/totem'; /** * Check if `base` is an ancestor of `head` (or HEAD if omitted). * Returns true if `git merge-base --is-ancestor` exits 0. */ export declare function isAncestor(cwd: string, base: string, head?: string): boolean; /** * Get shortstat between two refs. Returns parsed line counts. */ export declare function getShortstat(cwd: string, base: string, head?: string): { files: number; insertions: number; deletions: number; }; /** * Get file statuses between two refs. Returns array of { status, file }. * Status is 'A' (added), 'M' (modified), 'D' (deleted), etc. */ export declare function getNameStatus(cwd: string, base: string, head?: string): Array<{ status: string; file: string; }>; /** * Get the diff between two refs. */ export declare function getDiffBetween(cwd: string, base: string, head?: string): string; export type DiffForReviewSource = 'explicit-range' | 'staged' | 'uncommitted' | 'branch-vs-base'; export interface DiffForReviewOptions { staged?: boolean; /** Explicit ref range (mmnto-ai/totem#1717). When set, bypasses the implicit fallback chain. */ diff?: string; /** * Force the branch-vs-base (push-gate) diff scope regardless of working-tree * state (mmnto-ai/totem#2091). Mutually exclusive with `staged` and `diff`. */ branch?: boolean; /** * Explicit base branch NAME for the forced branch-vs-base scope * (mmnto-ai/totem#2091). Resolved through `getGitBranchDiff`'s * origin-preference logic (`origin/...HEAD`, else local `` — * mmnto-ai/totem#2054); NOT a raw ref range. Setting `base` implies * `branch`. Mutually exclusive with `staged` and `diff`. */ base?: string; /** * Lint-only opt-in for the narrow-scope advisory (mmnto-ai/totem#2090). * When the resolved source is `staged`/`uncommitted` and the branch-vs-base * scope the pre-push gate checks would cover more files, a one-line warning * names the gap. Never set by `review` — staged-slice review is routinely * intentional (truncation-cliff workaround), so warning there trains ignore. */ warnNarrowScope?: boolean; } export interface DiffForReviewConfig { ignorePatterns: string[]; shieldIgnorePatterns?: string[]; } export interface DiffForReviewResult { diff: string; changedFiles: string[]; /** Which path produced the diff (mmnto-ai/totem#1717 — surfaced for operator-visible logging). */ source: DiffForReviewSource; /** * Resolved base ref for the scope, captured at derivation time (Prop 304 * verdict `diffScope`). Present only where the source makes it meaningful: * the resolved base branch name for `branch-vs-base`, the range's base * endpoint for `explicit-range`. Omitted for `staged`/`uncommitted` (no base * ref participates). Recorded here so downstream consumers never reconstruct * the scope refs from flags after the fact. */ base?: string; /** * Resolved head ref for the scope, captured at derivation time (Prop 304 * verdict `diffScope`). Present only for `explicit-range` (the range's head * endpoint). Omitted for `branch-vs-base` (head is the working `HEAD`, not a * scope-distinguishing ref) and for `staged`/`uncommitted`. */ head?: string; /** * The RAW CLI selector form (Prop 304 finding 10) — the operator's exact `--diff` * string, captured for `explicit-range` only. It distinguishes selectors that resolve * to the same refs but describe different lineages: `--diff main` (base-vs-working-tree, * no head) vs `--diff main..HEAD` (range mode) both resolve base='main' head='HEAD' but * must NOT share a round-chain lineage. Omitted for the non-explicit sources (no * ambiguity — the source + resolved refs already key them). */ selectorForm?: string; } /** * The discriminated no-changes result (mmnto-ai/totem#2473 conformance note 1): * the resolver had ALREADY resolved a concrete scope — staged→branch fallback, * an explicit range, or the forced branch-vs-base — by the time it found no * diff, and a bare `null` discarded that metadata. The admission record's * `no-diff` identity binds THIS resolved scope, so empty runs under different * scopes can never collapse into one observation. Field semantics match * {@link DiffForReviewResult} exactly (same population rules per source). */ export interface DiffForReviewEmpty { empty: true; source: DiffForReviewSource; base?: string; head?: string; selectorForm?: string; } /** * Maximum diff size (in characters) before the prompt assembler truncates. * Mirrored from `shield-templates.MAX_DIFF_CHARS` so the resolution-layer * warning fires on the same threshold as the actual truncation site. * * Kept as a separate constant here rather than imported from * `commands/shield-templates.ts` to avoid a circular CLI dependency * (`git.ts` is intended to be substrate for many commands, not just review). */ export declare const REVIEW_DIFF_TRUNCATION_THRESHOLD = 50000; /** * Cap on file names printed by the ignore-filter disclosure line * (mmnto-ai/totem#1748): enough to name every file in the observed exhibits * while bounding terminal noise when a broad pattern drops a large set; the * overflow is still counted (`+N more`). */ export declare const MAX_DISCLOSED_FILTERED_FILES = 8; /** * Cap on untracked file names printed by the empty-diff disclosure * (mmnto-ai/totem#2535). Sibling of {@link MAX_DISCLOSED_FILTERED_FILES} with * the same shown/`+N more` shape; kept separate so tuning one disclosure's * verbosity never silently retunes the other. */ export declare const MAX_DISCLOSED_UNTRACKED_FILES = 8; /** * Shared diff-fetching logic used by both `shield` and `lint` commands. * * Resolution order: * 1. `--branch` / `--base ` (forced push-gate scope, mmnto-ai/totem#2091 — * jumps straight to the branch-vs-base diff of step 4, ignoring the * working tree; mutually exclusive with 2 and 3) * 2. `--diff ` (explicit, no fallback) * 3. `--staged` (staged-only) or working-tree (`all`) diff * 4. Branch-vs-base diff (`...HEAD`) when 3 yields nothing * * The chosen resolution path is logged to stderr (mmnto-ai/totem#1717) so the operator's * mental model matches the actual git invocation. Diffs exceeding * `REVIEW_DIFF_TRUNCATION_THRESHOLD` chars surface a warning here, before * the LLM call is made, so the operator can re-run with a narrower * `--diff ` instead of paying for a degraded review. * * Returns a {@link DiffForReviewEmpty} (carrying the RESOLVED scope) when no * changes are detected — never a bare `null`, which would discard the scope * the admission record must bind (mmnto-ai/totem#2473 conformance note 1). */ export declare function getDiffForReview(options: DiffForReviewOptions, config: DiffForReviewConfig, cwd: string, tag: string): Promise; //# sourceMappingURL=git.d.ts.map