@capgo/cli
Version:
A CLI to upload to capgo servers
67 lines (66 loc) • 2.29 kB
TypeScript
export type AnalyzeBehavior = 'ask_then_menu' | 'auto_upload' | 'skip';
export interface DecideInput {
isTTY: boolean;
aiAnalyticsFlag: boolean;
sendLogsFlag: boolean;
}
export declare function decideAnalyzeBehavior(input: DecideInput): AnalyzeBehavior;
export declare const CI_FAILURE_TIP = "Build failed. Tip: re-run with --ai-analytics for an AI-powered diagnosis, or --send-logs-to-support to upload the build logs to Capgo support.";
export interface CiFailureActionsInput {
aiAnalyticsFlag: boolean;
sendLogsFlag: boolean;
}
export interface CiFailureActions {
runAiAnalysis: boolean;
sendLogs: boolean;
tip: string | null;
}
export declare function decideCiFailureActions(input: CiFailureActionsInput): CiFailureActions;
export interface ShouldPrintCiTipInput {
isTTY: boolean;
aiAnalytics: boolean;
sendLogs: boolean;
}
export declare function shouldPrintCiTip(input: ShouldPrintCiTipInput): boolean;
export declare function writeLocalAiFile(jobId: string): Promise<string>;
export interface PostAnalyzeInput {
apiHost: string;
apikey: string;
jobId: string;
appId: string;
logs: string;
}
export declare const STREAM_FIRST_BYTE_TIMEOUT_MS = 120000;
export declare const STREAM_IDLE_TIMEOUT_MS = 45000;
export declare const STREAM_TOTAL_TIMEOUT_MS = 600000;
export type PostAnalyzeResult = {
kind: 'ok';
analysis: string;
} | {
kind: 'already_analyzed';
} | {
kind: 'too_big';
} | {
kind: 'upgrade_required';
message?: string;
} | {
kind: 'error';
status?: number;
message?: string;
partial?: string;
};
export interface PostAnalyzeStreamInput extends PostAnalyzeInput {
onChunk?: (text: string) => void;
}
export declare function postAnalyzeStreamRequest(input: PostAnalyzeStreamInput): Promise<PostAnalyzeResult>;
export declare const HARD_LOG_SIZE_LIMIT: number;
export declare function isLogTooBig(jobId: string): Promise<boolean>;
export interface RunCapgoAiAnalysisInput {
apiHost: string;
apikey: string;
jobId: string;
appId: string;
onChunk?: (text: string) => void;
}
export declare function runCapgoAiAnalysis(input: RunCapgoAiAnalysisInput): Promise<PostAnalyzeResult>;
export declare function releaseCapturedLogs(jobId: string): Promise<void>;