@builder.io/dev-tools
Version:
Builder.io Visual CMS Devtools
33 lines (32 loc) • 1.33 kB
TypeScript
import type { DevToolsSys } from "../../types";
import type { Credentials } from "../credentials";
import type { GitConfigs, GitDiagnostics } from "#ai-utils";
export interface RunCommandOptions {
cwd?: string;
sys: DevToolsSys;
timeout?: number;
skipLogging?: boolean;
stdin?: string;
retry?: number;
}
type FetchGitConfigsResult = {
success: true;
gitConfigs: GitConfigs;
} | {
success: false;
error: Error;
gitDiagnostics?: GitDiagnostics;
};
export declare function runCommand(cmd: string, args: string[], opts: RunCommandOptions): Promise<string>;
export declare function getMonotonicId(): string;
/**
* Returns true when the working tree has no uncommitted changes.
* Uses `git status --porcelain` which is more reliable than parsing stderr.
*/
export declare function hasCleanWorkTree(cwd: string, sys: DevToolsSys): Promise<boolean>;
/** Extract a human-readable error string from a failed git command. */
export declare function gitError(err: unknown): string;
export declare const isGitRepoCorrupted: (stdout: string, stderr: string) => boolean;
export declare const isGitRepoNotFound: (stdout: string, stderr: string) => boolean;
export declare function fetchGitConfigs(credentials: Credentials, projectId: string, debug: boolean): Promise<FetchGitConfigsResult>;
export {};