/** The `git clone` argv — split out so the --ref plumbing is testable without a network. */ export declare function cloneArgs(repoUrl: string, tmpDir: string, ref?: string): string[]; /** * With core.symlinks=false, every path git records as a link (mode 120000) * arrives in the clone as a plain file holding the link's target text. That * text is not the file: detection would read `docs/README.md` as the README * and write it into project.goal. The placeholders are taken out of faf's own * throwaway clone, so detection sees them as absent, as it sees any link. * Returns how many were taken out. */ export declare function dropLinkPlaceholders(cloneDir: string): number; /** Why a fetch failed: `url` (not a repo URL faf accepts) or `clone` (git * could not clone it; `reason` is git's last lines). */ export declare class FetchRepoError extends Error { readonly kind: 'url' | 'clone'; readonly reason?: string | undefined; constructor(message: string, kind: 'url' | 'clone', reason?: string | undefined); } export interface FetchRepoOptions { /** Clone this branch or tag. */ ref?: string; /** Give up on the clone after this many milliseconds (default 120 000). */ timeoutMs?: number; } export interface FetchedRepo { /** The cloned folder, link placeholders taken out. Read it; don't keep it. */ dir: string; /** The normalized URL, for authorFafFromRepo(dir, { repoUrl }). */ repoUrl: string; /** Removes the temp folder. Safe to call more than once. */ cleanup(): void; } /** * Fetch a repo the way `faf git` does: normalize the URL, shallow clone * (no shell, links not followed) into a temp folder, take out link * placeholders. Call `cleanup()` when done, in a `finally`. * * ```ts * import { fetchRepo } from 'faf-cli/fetch'; * import { authorFafFromRepo, suggestIntent } from 'faf-cli'; * const repo = await fetchRepo('tokio-rs/axum'); * try { * const data = authorFafFromRepo(repo.dir, { repoUrl: repo.repoUrl }); * const suggestions = suggestIntent(repo.dir); * } finally { * repo.cleanup(); * } * ``` */ export declare function fetchRepo(url: string, options?: FetchRepoOptions): Promise; export interface GithubDescriptionOptions { /** A GitHub token; default GITHUB_TOKEN, then GH_TOKEN. Needed for a private * repo, and it raises the rate limit. */ token?: string; /** Give up after this many milliseconds (default 10 000). */ timeoutMs?: number; } /** * The repo's GitHub description, for a goal suggestion (#237), or null: not a * GitHub repo, no description, no network, a rate limit, a private repo * without a token. Never throws; the description is only ever a suggestion, * so a fetch that fails just means no suggestion. One GitHub API call. */ export declare function githubDescription(repo: string, options?: GithubDescriptionOptions): Promise;