/// import * as child_process from 'child_process'; import { GitRepoInfo } from 'git-repo-info'; import { ITerminal } from '@rushstack/terminal'; /** * @internal */ declare type Constructable = abstract new (...args: any[]) => T; /** * Get instance from container * * @alpha */ export declare function getFromContainerAsync(clazz: Constructable): Promise; /** * Help class for git operations * * @alpha */ export declare class GitService { private _checkedGitPath; private _gitPath; private _gitUser; private _gitEmail; private _isSparseCheckoutMode; private _terminalService; private _telemetryService; private _commandService; setGitConfig(k: string, v: string | number | boolean, option?: { dryRun?: boolean; global?: boolean; replaceAll?: boolean; add?: boolean; }): void; getGitConfig(k: string, option?: { dryRun?: boolean; global?: boolean; array?: boolean; }): string | undefined; unsetGitConfig(k: string): void; setRecommendConfig(option?: { overwrite?: boolean; dryRun?: boolean; }): void; getGitUser(): string | undefined; getGitEmail(): string | undefined; getIsSparseCheckoutMode(): boolean | undefined; /** * Returns the path to the GitService binary if found. Otherwise, return undefined. */ get gitPath(): string | undefined; getGitPathOrThrow(): string; executeGitCommand({ args, workingDirectory }: IExecuteGitCommandParams): child_process.SpawnSyncReturns; executeGitCommandAndCaptureOutput({ args, workingDirectory }: IExecuteGitCommandParams): string; /** * Get the humanish basename from the URL * * The implementation aligns with the git source code at * https://github.com/git/git/blob/3e0d3cd5c7def4808247caf168e17f2bbf47892b/dir.c#L3175 */ getBasenameFromUrl(url: string): string; getRepoInfo(): GitRepoInfo; getBranchRemote(branch: string): string; getGitVersion(): [number, number, number] | undefined; hasFile(filename: string, branch: string): boolean; getObjectType(object: string): IObjectType | undefined; getCurrentBranch(): string; /** * Retrieves the previous branch name using `@{-n}` syntax * * Assume: * git checkout feature * git checkout main * --- * `git checkout @{-1}` equals to run `git checkout feature`. * Running `getPreviousBranch(1)` works in the similar way and returns "feature" in this case. */ getPreviousBranch(n: number): string; /** * Check existence for a list of branch name */ checkRemoteBranchesExistenceAsync: (remote: string, branches: string[]) => Promise>; /** * Check existence for one branch name. * * Function "checkRemoteBranchesExistenceAsync" is preferred if you are going to check a list of branch name. */ checkRemoteBranchExistenceAsync: (remote: string, branch: string) => Promise; private _processResult; } /** * The package json information of the package who calls "sparo-lib". * @alpha */ export declare interface ICallerPackageJson { /** * Package name */ name: string; /** * Package version */ version: string; } /** * @alpha */ export declare type ICollectTelemetryFunction = (data: ITelemetryData) => Promise; /** * @alpha */ export declare interface IExecuteGitCommandParams { args: string[]; workingDirectory?: string; } /** * Options to pass to the sparo "launch" functions. * * @public */ export declare interface ILaunchOptions { /** * A callback function to tell Sparo how to handle telemetry * @internal * * @remarks * This is a temporary implementation for customizing telemetry reporting. * Later, the API will be redesigned to meet more generic requirements. */ collectTelemetryAsync?: ICollectTelemetryFunction; /** * Provide the caller package JSON info. * @internal * * @remarks * It is used to update notification. */ callerPackageJson?: ICallerPackageJson; /** * Provide the additional skeleton folders. * @internal */ additionalSkeletonFolders?: string[]; } /** * @alpha */ export declare type IObjectType = 'blob' | 'tag' | 'commit' | 'tree'; /** * @alpha */ export declare interface ITelemetryData { /** * Command name * @example clone */ readonly commandName: string; /** * Argument list */ readonly args: string[]; /** * Duration in seconds */ readonly durationInSeconds: number; /** * A timestamp in milliseconds (from `performance.now()`) when the operation started. * If the operation was blocked, will be `undefined`. */ readonly startTimestampMs?: number; /** * A timestamp in milliseconds (from `performance.now()`) when the operation finished. * If the operation was blocked, will be `undefined`. */ readonly endTimestampMs?: number; /** * Indicates raw git command */ readonly isRawGitCommand?: boolean; } export { ITerminal } /** * General operations for Sparo engine. * * @public */ export declare class Sparo { private constructor(); static launchSparoAsync(launchOptions: ILaunchOptions): Promise; static launchSparoCIAsync(launchOptions: ILaunchOptions): Promise; } /** * Help class for terminal UI * * @alpha */ export declare class TerminalService { private _terminal; private _terminalProvider; private _asciiHeaderWidth; constructor(); setIsVerbose(value: boolean): void; setIsDebug(value: boolean): void; get terminal(): ITerminal; writeTaskHeader(taskTitle: string): void; writeTaskFooter(): void; get isDebug(): boolean; } export { }