UNPKG

@capgo/cli

Version:
38 lines (37 loc) • 1.84 kB
import { appendFile, mkdir, readFile, unlink, writeFile } from 'node:fs/promises'; export declare function getLogCapturePath(jobId: string): string; export declare function getAiPromptPath(jobId: string): string; export declare function shouldCaptureLogs(): boolean; interface LogCaptureFileOperations { appendFile: typeof appendFile; mkdir: typeof mkdir; readFile: typeof readFile; unlink: typeof unlink; writeFile: typeof writeFile; } export interface LogCaptureLifecycle { startCaptureForJob: (jobId: string) => Promise<void>; appendCapturedLine: (jobId: string, line: string) => void; flushCapturedLogs: (jobId: string) => Promise<void>; readCapturedLog: (jobId: string) => Promise<string>; cleanupCapturedJobFiles: (jobId: string, opts: CleanupOptions) => Promise<void>; } /** * Create an isolated capture lifecycle. The optional file-operation overrides * make slow and failing I/O deterministic in regression tests. */ export declare function createLogCaptureLifecycle(overrides?: Partial<LogCaptureFileOperations>): LogCaptureLifecycle; export declare const startCaptureForJob: (jobId: string) => Promise<void>; export declare const appendCapturedLine: (jobId: string, line: string) => void; export declare const flushCapturedLogs: (jobId: string) => Promise<void>; export declare const readCapturedLog: (jobId: string) => Promise<string>; export interface CleanupOptions { keepAiPromptFile: boolean; } export declare const cleanupCapturedJobFiles: (jobId: string, opts: CleanupOptions) => Promise<void>; /** * Register process-level cleanup handlers. Returns a function that removes * the handlers (call from request.ts after the build flow finishes normally). */ export declare function registerCleanupHandlers(jobId: string, getKeepPromptFile: () => boolean): () => void; export {};