import type { BranchProtectionResult, CleoKnownLabel, CleoLabelPalette, LabelDefinition, LabelEnsureResult, PRCreateOptions, PRLabelResolution, PRMode, PRResult, RepoIdentity } from '@cleocode/contracts'; export type { BranchProtectionResult, CleoKnownLabel, CleoLabelPalette, LabelDefinition, LabelEnsureResult, PRCreateOptions, PRLabelResolution, PRMode, PRResult, RepoIdentity, }; /** * Check if the `gh` CLI is available by attempting to run `gh --version`. * Does NOT use `which` to remain cross-platform. */ export declare function isGhCliAvailable(): boolean; /** * Parse a GitHub remote URL (HTTPS or SSH) into owner and repo components. * Returns null if the URL cannot be parsed. * * Supported formats: * https://github.com/owner/repo.git * https://github.com/owner/repo * git@github.com:owner/repo.git * git@github.com:owner/repo */ export declare function extractRepoOwnerAndName(remote: string): RepoIdentity | null; /** * Detect whether a branch has protection rules enabled. * * Strategy 1 (preferred): use `gh api` to query GitHub branch protection. * Strategy 2 (fallback): use `git push --dry-run` and inspect stderr. */ export declare function detectBranchProtection(branch: string, remote: string, projectRoot?: string): Promise; /** * Return the names of labels currently defined on the GitHub repo for `cwd`. * * Uses `gh label list --json name` and tolerates failures by returning an * empty list (caller falls back to "skip filtering"). The intent is to avoid * `gh pr create --label X` failing the entire release because a label happens * to be missing on a particular repo. */ export declare function listExistingLabels(projectRoot?: string): string[]; /** * Create labels on the GitHub repo that are missing locally but recognised by * CLEO. Returns the subset of `requested` that now exists (either pre-existed * or was created successfully). Silently skips unknown labels. * * `gh label create` is idempotent under the `--force` flag in modern gh * versions, but to stay portable we filter against `listExistingLabels` first. */ export declare function ensureCleoLabelsExist(requested: string[], projectRoot?: string): LabelEnsureResult; /** * Build the markdown body for a GitHub pull request. */ export declare function buildPRBody(opts: PRCreateOptions): string; /** * Format human-readable instructions for creating a PR manually. */ export declare function formatManualPRInstructions(opts: PRCreateOptions): string; /** * Resolve the set of labels to actually pass to `gh pr create`, given the set * requested by the caller. * * Order: * 1. Auto-create CLEO-known labels (release/latest/beta/alpha) if absent * 2. Query the repo's existing labels and intersect — labels we can't auto- * create are dropped here (with a `missing` list returned for logging) * 3. Return the final ensured set so `gh pr create --label …` never errors * out on a non-existent label * * Exported so the engine layer (and tests) can preview filtering before a * real PR is opened. */ export declare function resolvePRLabels(requested: string[] | undefined, projectRoot?: string): PRLabelResolution; /** * Create a GitHub pull request using the `gh` CLI, or return manual instructions * if the CLI is unavailable or the operation fails. * * Labels in `opts.labels` are filtered against the repo's existing labels via * {@link resolvePRLabels} — labels that don't exist (and aren't in CLEO's * known palette) are silently dropped rather than failing the PR. If `gh pr * create` still rejects a label (race with another label deletion, custom * validation, etc.), the call retries once without any labels. */ export declare function createPullRequest(opts: PRCreateOptions): Promise; //# sourceMappingURL=github-pr.d.ts.map