/** * Git contribution workflow — commit, push, PR for repo changes. * * Enables editing assets in cloned repos and contributing changes back upstream. */ /** * A single file that has been modified in a repository working tree. * * @docLink packages/asset-manager/api-reference#contrib */ export interface LocalChange { /** Short git status code (e.g. `"M"`, `"A"`, `"D"`). */ status: string; /** Path to the changed file, relative to the repository root. */ path: string; } /** * Comparison between a local repository clone and its upstream remote. * * @docLink packages/asset-manager/api-reference#contrib */ export interface ForkComparison { /** Number of commits the local clone is ahead of the upstream branch. */ ahead: number; /** Number of commits the local clone is behind the upstream branch. */ behind: number; /** Files changed in local commits not yet pushed to upstream. */ aheadFiles: string[]; /** Files changed in upstream commits not yet pulled locally. */ behindFiles: string[]; /** Error message if the comparison could not be performed. */ error?: string; } /** * Result of a repository sync operation. * * @docLink packages/asset-manager/api-reference#contrib */ export interface SyncResult { /** Number of catalog entries found after syncing. */ count: number; /** Error message when the sync failed. */ error?: string; } /** * List uncommitted changes in a local repository clone. * * @param repoDir - Absolute path to the repository root. * @returns Array of changed files with their git status codes. Returns `[]` when the * directory is not a git repository or `git status` fails. * @docLink packages/asset-manager/api-reference#contrib */ export declare function localChanges(repoDir: string): LocalChange[]; /** * Return `true` when the repository has uncommitted changes. * * @param repoDir - Absolute path to the repository root. * @docLink packages/asset-manager/api-reference#contrib */ export declare function hasLocalChanges(repoDir: string): boolean; /** * Return the unified diff of all uncommitted changes in the repository. * * @param repoDir - Absolute path to the repository root. * @returns Unified diff output from `git diff HEAD`, or `""` when there are no changes * or the directory is not a git repository. * @docLink packages/asset-manager/api-reference#contrib */ export declare function getDiff(repoDir: string): string; /** * Stage all changes and create a commit in the repository clone. * * If `branch` is provided, creates or switches to that branch before committing. * * @param repoDir - Absolute path to the repository root. * @param message - Git commit message. * @param branch - Branch name to create or switch to before committing. * @returns `[true, commitOutput]` on success, `[false, errorMessage]` on failure. * @docLink packages/asset-manager/api-reference#contrib */ export declare function commitChanges(repoDir: string, message: string, branch?: string): [boolean, string]; /** * Push a local branch to a remote URL (adds it as a `"fork"` git remote). * * @param repoDir - Absolute path to the repository root. * @param remoteUrl - Remote URL to push to (e.g. a GitHub fork's HTTPS/SSH URL). * @param branch - Local branch name to push. * @returns `[true, ""]` on success, `[false, errorMessage]` on failure. * @docLink packages/asset-manager/api-reference#contrib */ export declare function pushToRemote(repoDir: string, remoteUrl: string, branch: string): [boolean, string]; /** * Open a pull request on GitHub using the `gh` CLI. * * @param upstreamUrl - GitHub repository URL or `owner/repo` identifier. * @param title - Pull request title. * @param body - Pull request description (Markdown). * @param head - Branch name containing the changes. * @param base - Base branch to merge into. Defaults to `"main"`. * @returns `[true, prUrl]` on success, `[false, errorMessage]` on failure. * @docLink packages/asset-manager/api-reference#contrib */ export declare function createPr(upstreamUrl: string, title: string, body: string, head: string, base?: string): [boolean, string]; /** * Compare a local repository clone with its upstream remote. * * Temporarily registers `upstream` as the `"upstream"` git remote, fetches the * specified branch, and counts diverging commits in both directions. * * @param repoDir - Absolute path to the local repository clone. * @param upstream - Remote URL of the upstream repository. * @param branch - Branch to compare against. Defaults to `"main"`. * @returns {@link ForkComparison} with ahead/behind counts and changed file lists. * @docLink packages/asset-manager/api-reference#contrib */ export declare function compareWithUpstream(repoDir: string, upstream: string, branch?: string): ForkComparison; /** * List files added or modified locally compared with an upstream branch. * * Fetches the upstream branch and returns only the files that exist in the local * branch but not in upstream (additions and modifications, not deletions). * * @param repoDir - Absolute path to the local repository clone. * @param upstream - Remote URL of the upstream repository. * @param branch - Upstream branch to compare against. Defaults to `"main"`. * @returns Object with `files` list and an optional `error` string on failure. * @docLink packages/asset-manager/api-reference#contrib */ export declare function listAdditions(repoDir: string, upstream: string, branch?: string): { files: string[]; error?: string; }; //# sourceMappingURL=contrib.d.ts.map